-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoop(task_6).java
More file actions
91 lines (54 loc) · 1.84 KB
/
Copy pathoop(task_6).java
File metadata and controls
91 lines (54 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
package retailitem;
public class RetailItem {
private String description;
private int UnitsOnHand;
private double Price;
RetailItem (String description,int UnitsOnHand,double Price)
{
this.description = description;
this.UnitsOnHand = UnitsOnHand;
this.Price = Price;
}
public void display()
{
System.out.println("About product: "+description);
System.out.println("The units on hand are: "+UnitsOnHand);
System.out.println("The price of the item is : "+Price);
}
public static void main(String[] args) {
RetailItem ri1 = new RetailItem("Made in China",34,5999.95);
RetailItem ri2 = new RetailItem("Made in Turkey",50,3432.95);
ri1.display();
ri2.display();
}
}
////////////////////////////2nd part of the question///////////////////////////
package retailitem;
public class RetailItem {
private String description;
private int UnitsOnHand;
double Price;
public void display()
{
System.out.println("About product: "+description);
System.out.println("The units on hand are: "+UnitsOnHand);
System.out.println("The price of the item is : "+Price);
}
public static void main(String[] args) {
RetailItem Item1 = new RetailItem();
RetailItem Item2 = new RetailItem();
RetailItem Item3 = new RetailItem();
Item1.description ="Jacket";
Item1.UnitsOnHand = 12;
Item1.Price =5999.95;
Item2.description ="Designer jeans";
Item2.UnitsOnHand = 40;
Item2.Price = 3432.95;
Item3.description ="Shirt";
Item3.UnitsOnHand = 20;
Item3.Price = 2494.95;
Item1.display();
Item2.display();
Item3.display();
}
}