Answer to Question #10508 in Java | JSP | JSF for Johnnie

Question #10508
Design the class Bill with data members to store a patient's ID and the patient's hospital charges such as pharmacy charges for medicine, the doctor's fee, and the room charges. Add appropriate constructors and methods to initialize, access, and manipulate the data members.
1
Expert's answer
2012-06-07T09:41:45-0400
/*
* Design the class Bill with data members to store a patient's ID
and
the patient's hospital charges
* such as pharmacy charges for
medicine, the doctor's fee, and the
room charges.
* Add appropriate
constructors and methods to initialize, access, and
manipulate the data
members.
*/
public class Bill {

private int id;
private double
pharmacyCharges;
private double doctorsFee;
private double
roomCharges;

public Bill(int id) {
this.id =
id;
this.pharmacyCharges = 0.0;
this.doctorsFee = 0.0;
this.roomCharges
= 0.0;
}

public Bill(int id, double pharmacyCharges, double
doctorsFee,
double roomCharges) {
this.id = id;
this.pharmacyCharges =
pharmacyCharges;
this.doctorsFee = doctorsFee;
this.roomCharges =
roomCharges;
}

public int getId() {
return id;
}

public
void setId(int id) {
this.id = id;
}

public double
getPharmacyCharges() {
return pharmacyCharges;
}

public void
setPharmacyCharges(double pharmacyCharges) {
this.pharmacyCharges =
pharmacyCharges;
}

public double getDoctorsFee() {
return
doctorsFee;
}

public void setDoctorsFee(double doctorsFee)
{
this.doctorsFee = doctorsFee;
}

public double getRoomCharges()
{
return roomCharges;
}

public void setRoomCharges(double
roomCharges) {
this.roomCharges = roomCharges;
}

}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS