-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNetAmount.java
74 lines (43 loc) · 1.79 KB
/
NetAmount.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import java.util.Scanner;
class NetAmount
{
public static void main(String args[])
{
double amount,discount=0.0,netamount=0.0;
char type;
Scanner obj=new Scanner(System.in);
System.out.println("Enter the Amount of Purchase:");
amount=obj.nextDouble();
System.out.println("Enter the Type of Purchase");
System.out.println("L-for Mill cloth or D-for Handloom cloth:");
type=obj.next().charAt(0);
switch(type)
{
case 'L':
if(amount>=0&&amount<=100)
discount=0;
else if(amount>=101&&amount<=200)
discount=amount*5.0/100;
else if(amount>=201&&amount<=300)
discount=amount*7.5/100;
else if(amount>300)
discount=amount*10.0/100;
break;
case 'D':
if(amount>=0&&amount<=100)
discount=amount*5.0/100;
else if(amount>=101&&amount<=200)
discount=amount*7.5/100;
else if(amount>=201&&amount<=300)
discount=amount*10.0/100;
else if(amount>300)
discount=amount*15.0/100;
break;
default:
System.out.println("Invalid choice");
}
netamount=amount-discount;
System.out.println("Discount Amount: "+discount);
System.out.println("Net Amount You have to pay is: "+netamount);
}
}