-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBillPrint.java
More file actions
130 lines (103 loc) · 6.68 KB
/
BillPrint.java
File metadata and controls
130 lines (103 loc) · 6.68 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
import java.util.Scanner;
class BillPrint {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
//Header
System.out.println("=================================================================================");
System.out.println("");
System.out.println("__ __ _ _ _ __ __ _");
System.out.println("\\ \\ / / | | | | (_) \\/ | | |");
System.out.println(" \\ \\ /\\ / /__| | ___ ___ _ __ ___ ___ | |_ ___ _| \\ / | __ _ _ __| |_");
System.out.println(" \\ \\/ \\/ / _ \\ |/ __/ _ \\| '_ ` _ \\ / _ \\ | __/ _ \\ | | |\\/| |/ _` | `__| __|");
System.out.println(" \\ /\\ / __/ | (_| (_) | | | | | | __/ | || (_) | | | | | | (_| | | | |_");
System.out.println(" \\/ \\/ \\___|_|\\___\\___/|_| |_| |_|\\___| \\___\\___/ |_|_| |_|\\__,_|_| \\__|");
System.out.println("");
System.out.println("=================================================================================");
//details
System.out.println("");
System.out.print("Enter Customer Phone Number: ");
String phone = sc.nextLine();
System.out.println("");
System.out.print("Enter Customer Name: ");
String name = sc.nextLine();
System.out.println("");
System.out.println("=================================================================================");
// Item details
double basmathi=250.0,dhal=180.0,sugar=150.0,higland=1200.0,yoghurt=50.0,flour=120.0,soap=160.0;
int b,d,s,h,y,f,so;
System.out.println("");
System.out.print("Basmathi Qty(Kg) - ");
b = sc.nextInt();
System.out.println("");
System.out.print("Dhal Qty(Kg) - ");
d = sc.nextInt();
System.out.println("");
System.out.print("Sugar Qty(Kg) - ");
s = sc.nextInt();
System.out.println("");
System.out.print("Higland Qty - ");
h = sc.nextInt();
System.out.println("");
System.out.print("Yoghurt Qty - ");
y = sc.nextInt();
System.out.println("");
System.out.print("Flour Qty(Kg) - ");
f = sc.nextInt();
System.out.println("");
System.out.print("Soap Qty(Kg) - ");
so = sc.nextInt();
System.out.println("");
System.out.println("=================================================================================");
//Tot Call
double btot = basmathi*b;
double dtot = dhal*d;
double stot = sugar*s;
double htot = higland*h;
double ytot = yoghurt*y;
double ftot = flour*f;
double sotot = soap*so;
//Full Tot
double fulltotal = btot+dtot+stot+htot+ytot+ftot+sotot;
// Discount
double dis = (fulltotal*10)/100;
// Final Amount
double fa = fulltotal-dis;
// Bill summary
System.out.println("\n+---------------------------------------------------------------+");
System.out.println("| _ __ __ ______ _______ |");
System.out.println("| (_) | \\/ | /\\ | __ \\__ __| |");
System.out.println("| _ | \\ / | / \\ | |__) | | | |");
System.out.println("| | | | |\\/| | / /\\ \\ | |_ / | | |");
System.out.println("| | | | | | |/ ____ \\| | \\ \\ | | |");
System.out.println("| |_| |_| |_/_/ \\_\\_| \\_\\ |_| |");
System.out.println("| 225,Galle Road,Panadura. |");
System.out.println("| |");
System.out.println("+---------------------------------------------------------------+");
System.out.printf("| # Tel : %-32s|\n", phone );
System.out.printf("| # Name : %-32s|\n", name );
System.out.println("+----------------+-------------+---------------+----------------+");
System.out.println("| | Qty | unit price | Total |");
System.out.println("+----------------+-------------+---------------+----------------+");
System.out.printf("| # Basmathi | %3d | %6.1f | %6.1f |\n" , b , basmathi , btot );
System.out.println("| | | | |");
System.out.printf("| # Dhal | %3d | %6.1f | %6.1f |\n" , d , dhal , dtot );
System.out.println("| | | | |");
System.out.printf("| # Sugar | %3d | %6.1f | %6.1f |\n" , s , sugar , stot );
System.out.println("| | | | |");
System.out.printf("| # Higland | %3d | %6.1f | %6.1f |\n" , h , higland , htot );
System.out.println("| | | | |");
System.out.printf("| # Yoghurt | %3d | %6.1f | %6.1f |\n" , y , yoghurt , ytot );
System.out.println("| | | | |");
System.out.printf("| # Flour | %3d | %6.1f | %6.1f |\n" , f , flour , ftot );
System.out.println("| | | | |");
System.out.printf("| # Soap | %3d | %6.1f | %6.1f |\n" , so , soap , sotot );
System.out.println("| | | | |");
System.out.println("+----------------+-------------+---------------+----------------+");
System.out.printf("| | Total | %6.1f |\n" , fulltotal );
System.out.println("| +---------------+----------------+");
System.out.printf("| | discount(10%%) | %6.1f |\n" , dis );
System.out.println("| +---------------+----------------+");
System.out.printf("| | price | %6.1f |\n" , fa );
System.out.println("+------------------------------+---------------+----------------+");
}
}