0% found this document useful (0 votes)
23 views3 pages

Task 1 Updated

The document defines a Low_Bills class with attributes for an account number, name, bill month, year, previous reading, current reading and total. It includes default and parameterised constructors, getters and setters for each attribute, a method to calculate the bill total based on the current reading, and a method to print the account details.

Uploaded by

scribd.pagla
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views3 pages

Task 1 Updated

The document defines a Low_Bills class with attributes for an account number, name, bill month, year, previous reading, current reading and total. It includes default and parameterised constructors, getters and setters for each attribute, a method to calculate the bill total based on the current reading, and a method to print the account details.

Uploaded by

scribd.pagla
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

package Finals;

public class Low_Bills {


//Attributes
private int Account_No;
private String Account_Name;
private String Bill_Month;
private int Bill_Year;
private double Previous_Reading;
private double Current_Reading;
private double Bill_Total;

//Default Constructor
public Low_Bills(){
this.Account_No=0;
this.Account_Name=null;
this.Bill_Month=null;
this.Bill_Year=0;
this.Previous_Reading=0.0;
this.Current_Reading=0.0;
this.Bill_Total=0.0;
}

//Set Operators
public void SetAccount_No(int acno) {

this.Account_No=acno;
}

public void SetAccount_Name(String acnm) {

this.Account_Name=acnm;
}

public void SetBill_Month(String bm) {

this.Bill_Month=bm;
}

public void SetBill_Year(int by) {

this.Bill_Year=by;
}

public void SetPrevious_Reading(double pr) {

this.Previous_Reading=pr;
}

public void SetCurrent_Reading(double cr) {

this.Current_Reading=cr;
}

//Get Operators
public int GetAccount_No() {

return this.Account_No;
}

public String GetAccount_Name() {

return this.Account_Name;
}

public String GetBill_Month() {

return this.Bill_Month;
}

public int GetBill_Year() {

return this.Bill_Year;
}

public double GetPrevious_Reading() {

return this.Previous_Reading;
}

public double GetCurrent_Reading() {

return this.Current_Reading;
}

public void CalCurrent_Reading(double Reading) {

if (Reading>=0 || Reading<=100 )
{

double baseCharge = 1500;

double tax = 0.15;

double FuelCharge =baseCharge * 1.95;

double subbillcost = FuelCharge * tax;

Bill_Total = FuelCharge + subbillcost;

else if (Reading>=101 || Reading<=250 )


{

double baseCharge = 2500;


double tax = 0.15;

double FuelCharge =baseCharge * 1.95;

double subbillcost = FuelCharge * tax;

Bill_Total = FuelCharge + subbillcost;


}

else if (Reading>250)
{

double baseCharge = 3500;

double tax = 0.15;

double FuelCharge =baseCharge * 1.95;

double subbillcost = FuelCharge * tax;

Bill_Total = FuelCharge + subbillcost;


}

else
{
System.out.println("Invalid Reading");
}

public void PrintDetails() {

System.out.println("Your Account Number is:" +this.Account_No);


System.out.println("Your Account Name is:" +this.Account_Name);
System.out.println("Your Bill Month is:" +this.Bill_Month);
System.out.println("Your Bill Year is:" +this.Bill_Year);
System.out.println("Your Previous Reading is:" +this.Previous_Reading);
System.out.println("Your Current Reading is:" +this.Bill_Total);

}
}

You might also like