Package Model
Class WrittenBills
java.lang.Object
Model.WrittenBills
The WrittenBills class represents a collection of utility bills stored in a
file.
-
Field Summary
Modifier and TypeFieldDescriptionprivate ArrayList<UtilityBill>
The list of utility bills.private String
The path of the file containing the utility bills.private int
The ID of the utility bill. -
Constructor Summary
ConstructorDescriptionConstructs a WrittenBills instance, initializing the list of bills and loading existing bills from a file. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a utility bill for the Customer.void
deleteBill
(int billId) Deletes a utility bill for the Customer.void
Edits a utility bill for the Customer.findbill
(int billId) Finds a utility bill by its ID.boolean
findiD
(int id) Finds a utility bill by its ID.getBills()
Gets the list of utility bills.void
Increases the ID of the utility bill.void
Loads utility bills from a file.private void
Saves the utility bills to a file.
-
Field Details
-
bills
The list of utility bills. -
billsFilePath
The path of the file containing the utility bills. -
id
private int idThe ID of the utility bill.
-
-
Constructor Details
-
WrittenBills
public WrittenBills()Constructs a WrittenBills instance, initializing the list of bills and loading existing bills from a file.
-
-
Method Details
-
getBills
Gets the list of utility bills.- Returns:
- ArrayList of UtilityBill representing the bills.
-
loadBillsFromFile
public void loadBillsFromFile()Loads utility bills from a file. -
findiD
public boolean findiD(int id) Finds a utility bill by its ID.- Parameters:
id
- The ID of the bill to be found.
-
addBill
Adds a utility bill for the Customer.- Parameters:
username
- The username of the Customer.utilityType
- The type of utility.meterMeasurement
- The meter measurement.date
- The date of the bill.
-
increaseID
public void increaseID()Increases the ID of the utility bill. -
deleteBill
public void deleteBill(int billId) Deletes a utility bill for the Customer.- Parameters:
billId
- The ID of the bill to be deleted.
-
editBill
Edits a utility bill for the Customer.- Parameters:
billId
- The ID of the bill to be edited.newMeterMeasurement
- The new meter measurement.
-
findbill
Finds a utility bill by its ID.- Parameters:
billId
- The ID of the bill to be found.
-
saveBillsToFile
private void saveBillsToFile()Saves the utility bills to a file.
-