-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathLab2B.java
More file actions
43 lines (39 loc) · 973 Bytes
/
Lab2B.java
File metadata and controls
43 lines (39 loc) · 973 Bytes
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
// 2B: A cloth showroom has announced the following discount on purchase of items based on the amount purchased.
//write a program to calculate the bill amount after discount.
// Amount Discount
// <2000 5%
// 2000-5000 25%
// 5000-10000 35%
// >10000 50%
import java.util.Scanner;
public class Lab2B {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
System.out.println("Enter the total cost: ");
double bill = s.nextDouble();
if (bill < 2000)
bill -= 0.05 * bill;
else if (bill <= 5000)
bill -= 0.25 * bill;
else if (bill <= 1000)
bill -= 0.35 * bill;
else
bill -= 0.5 * bill;
System.out.println("Total Bill= " + bill);
}
}
/*
* Output:
*
* Enter the total cost:
* 1000
* Total Bill= 650.0
*
* Enter the total cost:
* 5000
* Total Bill= 3750.0
*
* Enter the total cost:
* 10000
* Total Bill= 5000.0
*/