-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJewellery.java
More file actions
136 lines (113 loc) · 2.87 KB
/
Copy pathJewellery.java
File metadata and controls
136 lines (113 loc) · 2.87 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
/** C23727729 Khalid Roble**/
import java.io.*;
/**1. Create Superclass Jewellery. */
public class Jewellery implements Serializable
{
/** 1.1 Create standard operations. */
private double price;
private int quantity;
private String name;
private String brand;
private String colour;
private boolean measure_clarity;
public Jewellery()
{
this.price= 0.0;
this.quantity= 0;
this.name = "";
this.brand = "";
this.colour= "";
this.measure_clarity = false;
}
public Jewellery(double price,int quantity, String name,String brand, String colour)
{
this.price = price;
this.quantity = quantity;
this.name = name;
this.brand = brand;
this.colour = colour;
this.measure_clarity = false;
}
public Jewellery(double price,int quantity, String name,String brand, String colour, boolean measure_clarity)
{
this.price = price;
this.quantity = quantity;
this.name = name;
this.brand = brand;
this.colour = colour;
this.measure_clarity = measure_clarity;
}
public double getPrice()
{
return this.price;
}
public int getQuantity()
{
return this.quantity;
}
public String getName()
{
return this.name;
}
public String getBrand()
{
return this.brand;
}
public String getColour()
{
return this.colour;
}
public boolean getMeasure()
{
return this.measure_clarity;
}
public void setPrice(double price)
{
this.price = price;
}
public void setQuantity(int quantity)
{
this.quantity = quantity;
}
public void setName(String name)
{
this.name = name;
}
public void setBrand(String brand)
{
this.brand = brand;
}
public void setColour(String colour)
{
this.colour = colour;
}
/**public void stock()
{
if(quantity==0)
{
System.out.println("Sorry there is no more stocks left from that particular item");
}
else
{
System.out.println("Your items/'s is successfully bought");
}
} */
public String toString()
{
String sentence;
sentence ="The name is: " +this.name+ "\n\n" +
"The brand is: "+this.brand+ "\n\n" +
"The Colour is: "+this.colour+ "\n\n" +
"The Price is: "+this.price+ " $"+"\n\n" +
"The Quantity: "+ this.quantity+ "\n\n";
if( this.price > 1000.0)
{
sentence = sentence + "The measurement is VVS"+ "\n\n";
measure_clarity = true;
}
else{
sentence = sentence + "The measurement is VS"+ "\n\n";
}
return sentence;
}
}