3838public class Main {
3939 public static void main (String [] args ) {
4040 Scanner input = new Scanner (System .in );
41- System .out .println (
42- """
43- =================================
44- === Invoice Management System ===
45- =================================
46- """ );
41+ System .out .println ("=================================\n " +
42+ "=== Invoice Management System ===\n " +
43+ "=================================\n " );
4744 boolean isUserWantsToContinue = true ;
4845 while (isUserWantsToContinue ) {
49- System .out .println (
50- """
51- Following Features are Available
52- 1 -> Add a Customer\s
53- 2 -> Generate an Invoice
54- 3 -> List all customers
55- 4 -> List all Invoices
56- 5 -> List all Invoices for a customer
57- 6 -> Display the full details of an invoice
58- 7 -> Exit
59- Enter Selection :""" );
46+ System .out .println ("Following Features are Available\n 1 -> Add a Customer\n 2 -> Generate an Invoice\n 3 -> List all customers\n 4 -> List all Invoices\n 5 -> List all Invoices for a customer\n 6 -> Display the full details of an invoice\n 7 -> Exit\n Enter Selection :" );
6047 int userChoice = input .nextInt ();
6148 switch (userChoice ) {
62- case 1 -> {
49+ case 1 :
6350 System .out .println ("\n Enter Customer Name:" );
6451 String CustomerName = input .next ();
6552 System .out .println ("\n Enter Customer Contact:" );
@@ -68,8 +55,9 @@ public static void main(String[] args) {
6855 Customer .UpdateCustomer (newCustomer );
6956 System .out .println ("\n Registration Success -> " + newCustomer .CustomerName );
7057 System .out .println ("=============================================================" );
71- }
72- case 2 -> {
58+ break ;
59+
60+ case 2 :
7361 List <Product > ProductList = new ArrayList <>();
7462 System .out .println ("\n Enter CustomerId:" );
7563 int CustomerIdForInvoice = input .nextInt ();
@@ -95,8 +83,9 @@ public static void main(String[] args) {
9583 Customer .UpdateCustomerInvoice (CustomerIdForInvoice , newInvoice .InvoiceId , ProductList );
9684 System .out .println ("Invoice Created For " + currentCustomer .CustomerName );
9785 System .out .println ("=============================================================" );
98- }
99- case 3 -> {
86+ break ;
87+
88+ case 3 :
10089 System .out .println ("CustomerName CustomerContact TotalPurchase" );
10190 for (Customer CustomerDetails : Customer .AllCustomers .values ()) {
10291 System .out .println (
@@ -107,14 +96,16 @@ public static void main(String[] args) {
10796 + CustomerDetails .TotalPurchase );
10897 }
10998 System .out .println ("=========================================================" );
110- }
111- case 4 -> {
99+ break ;
100+
101+ case 4 :
112102 for (Invoice userInvoice : Invoice .AllInvoices .values ()) {
113103 Invoice .ShowInvoiceDetails (userInvoice );
114104 }
115105 System .out .println ("=========================================================" );
116- }
117- case 5 -> {
106+ break ;
107+
108+ case 5 :
118109 System .out .println ("\n Enter CustomerId:" );
119110 int getInvoiceCustomerId = input .nextInt ();
120111 if (validateExistingCustomers (getInvoiceCustomerId )) break ;
@@ -123,8 +114,9 @@ public static void main(String[] args) {
123114 Invoice .ShowInvoiceDetails (userInvoice );
124115 }
125116 System .out .println ("=========================================================" );
126- }
127- case 6 -> {
117+ break ;
118+
119+ case 6 :
128120 System .out .println ("Enter InvoiceId:" );
129121 int invoiceId = input .nextInt ();
130122 if (!Invoice .AllInvoices .containsKey (invoiceId )) {
@@ -134,8 +126,11 @@ public static void main(String[] args) {
134126 Invoice userInvoice = Invoice .AllInvoices .get (invoiceId );
135127 Invoice .ShowInvoiceDetails (userInvoice );
136128 System .out .println ("=========================================================" );
137- }
138- case 7 -> isUserWantsToContinue = false ;
129+ break ;
130+
131+ case 7 :
132+ isUserWantsToContinue = false ;
133+ break ;
139134 }
140135 }
141136 }
0 commit comments