-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCarOrder.java
More file actions
135 lines (113 loc) · 2.3 KB
/
Copy pathCarOrder.java
File metadata and controls
135 lines (113 loc) · 2.3 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
/**
* Lab 4A: CarOrder.java
* Author: Te-Feng (Dylan) Pan
* Last Modified: 03/8/2013
* -------------------------------
* This class holds all values and
* It calculates the weekly pay.
* The main class is in CarOrderTest class
*/
public class CarOrder
{
// Fields
private String buyer;
private String carType;
private double cost, totalTax, totalCost;
private int quantity;
private boolean taxStatus;
private final double TAX = 0.0625;
/**
* The constructor accepts arguments for
* all fields.
*/
public CarOrder(String buy, String t, double c, int q, boolean status)
{
buyer = buy;
carType = t;
cost = c;
quantity = q;
taxStatus = status;
}
/**
* These are methods accepts an argument for
* the car order's buyer name and so on
*/
public void setBuyer(String buy)
{
buyer = buy;
}
public void setCarType(String t)
{
carType = t;
}
public void setCost(double c)
{
cost = c;
}
public void setQuantity(int q)
{
quantity = q;
}
public void setTaxStatus(boolean status)
{
taxStatus = status;
}
/**
* The getBuyer method returns the name of
* the car order's buyer.
*/
public String getBuyer()
{
return buyer;
}
public String getCarType()
{
return carType;
}
public double getCost()
{
return cost;
}
public int getQuantity()
{
return quantity;
}
public double getTax()
{
return totalTax;
}
public double getSaleTax()
{
if (getQuantity() > 10 || getQuantity() < 20)
{
totalTax = (cost * quantity * .95) * TAX;
}
else if (getQuantity() > 20)
totalTax = (cost * quantity * .9) * TAX;
return totalTax;
}
public double getTotalCost()
{
if (getQuantity() > 10 || getQuantity() < 20)
totalCost = (cost * quantity * .95) + totalTax;
else if (getQuantity() > 20)
totalCost = (cost * quantity * .9) + totalTax;
return totalCost;
}
// (getTaxStatus() ? "Y" : "N")
public boolean getTaxStatus()
{
if (!taxStatus)
return false;
else
{
return true;
}
}
/*
public String printHeading()
{
System.out.println("Buyer\tCar\tCost\tQuantity\tTax Status");
System.out.println("-------------------------------------------");
}*/
}