-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBilling.java
More file actions
23 lines (19 loc) · 768 Bytes
/
Billing.java
File metadata and controls
23 lines (19 loc) · 768 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
/**
* Billing
*/
public class Billing {
public static float computeBill(float price) {
return (float)price+(price*0.08f);
}
public static float computeBill(float price, short quantity) {
return (float)(price*quantity+ (price*quantity*0.08f));
}
public static float computeBill(float price, short quantity, float couponVal) {
return (float)((price*quantity)-couponVal)+(((price*quantity)-couponVal)*0.08f);
}
public static void main(String[] args) {
System.out.println("First Method: " + computeBill(1.2f));
System.out.println("Second Method: " + computeBill(1.2f, (short)10));
System.out.println("Third Method: " + computeBill(1.2f, (short)10, 3.1f));
}
}