-
Posts
-
-
By +sphbecker · Posted
ALL surveys are voluntary and very few attempt to track the same percipients over time. That doesn't mean they are invalid. Value doesn't claim it is an aggregate of their entire user base, that is why they call it as survey, which means exactly what it is. Yes, if Value created an anonymized collection of ALL users, that would be more accurate than a survey, but that is something they choose not to do. Just like elections are more accurate than political surveys. -
By tsupersonic · Posted
Just use AI...chatgpt or Copilot will write code for you, then test that and tweak it if needed. -
By TarasBuria · Posted
One UI 8 reveals Samsung's upcoming tri-fold phone by Taras Buria Samsung Galaxy Flex G prototype shown earlier this year. Source: Samsung Samsung was the pioneer of mainstream foldable phones. Despite the rocky start, the company cemented itself as the go-to option for those who want something more exciting than the standard, boring slab phone. However, during recent years, Samsung foldable phones became a bit stagnant and a target of heavy criticism in light of China-made ultra-thin devices and even tri-folding phones. Now, Samsung is getting ready to strike again. The South Korean giant is holding a special event next week where it is expected to unveil a bunch of new folding phones, including a cheaper Z Flip FE variant. However, the most exciting part of the announcement could be Samsung's first tri-folding smartphone, details about which were discovered in the latest One UI 8 beta build. The uncovered animations reveal a device that is similar to the Galaxy Fold 6 with one extra screen. It shows a tri-camera module and the location of its NFC chip. The inner display houses a punch-hole camera in the upper-right corner. Judging by the looks of it and another punch-hole camera, it appears that when fully unfolded, the outer screen will sit between two panels. Samsung seems to be taking a different route than Huawei, equipping its smartphone with two inward-folding hinges (as shown by the recent Galaxy Flex G concept). It is worth noting that those hinges are not identical, and the phone will have a strict folding procedure. Another animation revealed the phone displaying a warning not to fold the camera side first to prevent screen damage from the camera island. The device name is currently unknown, and the One UI 8 beta build does not reveal much except for "MULTIFOLD7" with its "vertical main," "main," and "reverse main" displays. The exact naming and renders could leak days ahead of the presentations, so Samsung fans should stay tuned for more details. Source: Android Authority -
By excalpius · Posted
In the civilized world, yes. But not in the US of A...
-
-
Recent Achievements
-
Devesh Beri earned a badge
Week One Done
-
956400 earned a badge
Week One Done
-
loose_observer earned a badge
First Post
-
BeeJay_Balu earned a badge
Week One Done
-
filminutz earned a badge
Week One Done
-
-
Popular Contributors
-
Tell a friend
Question
Tyrfing
Hey,
So,I'm a newbie to Java,I have an assignment and I'm stuck,I know online there's a lot of paid services who'd solve this for me,I don't want the answer.i've been trying to understand this for while.
-I have to use the toString method and have a test class.
-My problem is I don't understand how we'd update the invoice using just one constructor,and a set method(in short,how to make the output appear like it should).I Feel that what I did is wrong.
-Original Question ,output both mine and the how it supposed to be are the attachments.
First class:
public class Invoice {
private String PartNumber;
private String Description;
private int Quantity ;
private double Price ;
public Invoice(String PartNumber,String Description,int Quantity,double Price){
this.PartNumber=PartNumber;
this.Description=Description;
this.Quantity=Quantity;
this.Price=Price;
}
public Invoice(){
PartNumber="1234";
Description ="Hammer";
Quantity=2;
Price=14.95;
}
public void setPartNumber(String PartNumber){
this.PartNumber=PartNumber;
}
public void setDescription(String Description){
this.Description=Description;
}
public void setQuantity(int Quantity){
this.Quantity=Quantity;
}
public void setPrice(double Price){
this.Price=Price;
}
public double getInvoiceAmount(){
return Quantity*Price;
}
public String toString(){
return String.format("Part Number:%s\nDescription:%s\nQuantity:%d\nPrice:%.2f\nInvoice Amount:%.2f",PartNumber,Description,Quantity,Price,getInvoiceAmount());
}
public void display(){
System.out.println(toString());
}
}
Second class:
public class InvoiceTest {
public static void main(String[] args) {
Invoice a1=new Invoice();
a1.display();
Invoice a2=new Invoice();
a2.setDescription("Yellow Hammer");
a2.setPrice(19.49);
a2.setQuantity(3);
a2.display();
Invoice a3=new Invoice("5678"," Paint Brush",0,0.0);
a3.display();
Invoice a4=new Invoice("5678"," Paint Brush",0,0.0);
a4.setQuantity(3);
a4.setPrice(4.94);
a4.display();
}
}
Link to comment
https://www.neowin.net/forum/topic/1358584-stuck-in-a-java-question/Share on other sites
3 answers to this question
Recommended Posts