-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSalesBill.java
109 lines (100 loc) · 3.7 KB
/
SalesBill.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
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
import java.io.*;
class SalesBill
{
String item[]={“Bat”,”Wicket”,”Pad”,”Ball”};
double rate[]={500,50,300,100};
String order[]=new String[10];
double amt[]=new double[10];
String ans;
int items[]=new int[10];
int i,n=0,no,x=0;
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
Bill()
{
}
public void putOrder()throws IOException
{
System.out.println("**********************************************");
System.out.println(“Delhi Cricket Kit Supplier - List of Items”);
System.out.println("*********************************************");
System.out.println("Item No. Item Rate/item");
for(i=0;i< 10;i++)
{
System.out.println((i+1)+ ": "+item[i]+"------------------"+rate[i]);
}
System.out.println("You have to order at least 2 items. Enter item number to place order\n");
while(true)
{
if(x==10)
break;
System.out.println("Enter item number:");
no=Integer.parseInt(br.readLine());
order[x]=item[no-1];
amt[x]=rate[no-1];
System.out.println("How many items?:");
no=Integer.parseInt(br.readLine());
items[x]=no;
x++;
if(x>1)
{
System.out.println("Any More Item ?(Y/N):");
ans=br.readLine().toUpperCase();
if(ans.equals("N"))
break;
}
}
showBill();
}
private void showBill() throws IOException
{
double bamt=0,b;
double tax=0,tx;
System.out.println("You have ordered\n");
System.out.println("Item Rate No. of items");
for(i=0;i< x;i++)
{
System.out.println((i+1)+":"+order[i]+"---"+amt[i]+"---"+items[i]);
}
while(true)
{
if(x< 2)
break;
System.out.println("Want to cancel any item (Y/N):");
ans=br.readLine().toUpperCase();
if(ans.equals("N"))
break;
System.out.println("Which item to cancel, enter item number:");
no=Integer.parseInt(br.readLine());
for(i=no-1;i< x-1;i++)
{
order[i]=order[i+1];
amt[i]=amt[i+1];
items[i]=items[i+1];
}
x--;
}
System.out.println("Cash Memo\n");
System.out.println("*****************************************************************");
System.out.println("Item Quantity Rate Amount\n");
System.out.println("***************************************************************");
for (i=0;i< x;i++)
{
System.out.print(order[i]+ " "+items[i]+ " "+ amt[i]+ " ");
b=items[i]*amt[i];
System.out.println(b);
bamt=bamt+b;
}
System.out.println("Bill Amount Rs. "+bamt);
System.out.println("*******************");
if (bamt > 3000 ) tax = .17;else if (bamt > 1500.01 && bamt <= 2999.99) tax = .12;else tax = .07;
bamt=bamt+bamt*tax;
System.out.println("Total Amount including Tax Rs. "+bamt);
}
}
👋 Hi, I’m @aarushinair - Aarushi Nair (she/her/ella)
👀 I’m a Computer Science Engineering Student
💞️ I’m looking to collaborate on #java, #python, #R, #applicationdevelopment
🌱 #GirlsWhoCode #WomenInTech #WomenInIT #WomenInSTEM #CyberSecurity #QuantumComputing #BlockChain #AI #ML
📫 How to reach me: https://www.linkedin.com/in/aarushinair/
👩🏫 YouTube Channel - Code with Aarushi : https://www.youtube.com/channel/UCKj5T1ELHCmkGKujkpqtl7Q
🙋 Follow me on Twitter: https://twitter.com/aarushinair_