-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCellPhone.java
54 lines (46 loc) · 1.08 KB
/
CellPhone.java
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
/**
Lab 5 Starter program
The CellPhone class holds data about a cell phone.
*/
public class CellPhone
{
// Fields
private String model;
private String manufacturer; // Manufacturer
private double retailPrice; // Retail price
public CellPhone(String m, String man, double price)
{
setModel(m);
setManufacturer(man);
setRetailPrice(price);
}
public CellPhone()
{
this("","",0.0);
}
public void setModel(String m) {
model = m;
}
public void setManufacturer(String man)
{
manufacturer = man;
}
public void setRetailPrice(double price)
{
retailPrice = price;
}
public String getModel(){return model;}
public String getManufacturer()
{
return manufacturer;
}
public double getRetailPrice()
{
return retailPrice;
}
@Override
public String toString(){
return String.format("Model: %-20sManufacturer: %-20sretail price: %10.2f%n",getModel(), getManufacturer(),
getRetailPrice());
}
}