Repository navigation
Expand file tree
/
Copy pathCars.java
More file actions
55 lines (52 loc) · 1.46 KB
/
Copy pathCars.java
File metadata and controls
55 lines (52 loc) · 1.46 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
public class Cars
{
private int prod_Num; // product number
private String prod_Name; // product name
private int Total_unit; // total units in stock
private double Price_unit; // price per unit
// initialize four-argument constructor
public int Cars( int number, String name, int total, double price)
{
prod_Num = number;
prod_Name = name;
setTotal_unit (total); // validate and store total of cars
setPrice_unit (price); // validate and store price per car
} // end four-argument constructor
public void setprod_Num( int number )
{
prod_Num = number;
}
public int getprod_Num()
{
return prod_Num;
}
public void setprod_Name( String name)
{
prod_Name = name;
}
public String getprod_Name()
{
return prod_Name;
}
public void setTotal_unit( int total )
{
Total_unit = total;
}
public int getTotal_unit()
{
return Total_unit;
}
public void setPrice_unit( double price )
{
Price_unit = price;
}
public double getPrice_unit()
{
return Price_unit;
}
// calculate value of total inventory
public double inventory()
{
return Total_unit * Price_unit;
} // end method value
} // end class Cars