BILLINGSYSTEM
BILLINGSYSTEM
FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Scanner;
class Bill {
this.billNumber = billNumber;
this.customerName = customerName;
this.totalAmount = totalAmount;
}
public int getBillNumber() {
return billNumber;
return customerName;
return totalAmount;
return "Bill Number: " + billNumber + ", Customer Name: " + customerName + ", Total Amount: $" +
totalAmount;
}
int billCounter = 1;
while (true) {
System.out.println("4. Exit");
switch (choice) {
case 1:
bills.add(bill);
billCounter++;
break;
case 2:
System.out.println("Billing Records:");
System.out.println(b.getBillInfo());
break;
case 3:
saveBillingRecordsToNotepad(bills);
break;
case 4:
System.exit(0);
break;
default:
try {
printWriter.println(bill.getBillInfo());
printWriter.close();
} catch (IOException e) {
System.out.println("An error occurred while saving billing records to Notepad: " +
e.getMessage());