Hospital Charges Creat an application that calculates the total cost of a hospit
ID: 3575176 • Letter: H
Question
Hospital Charges
Creat an application that calculates the total cost of a hospital stay. The application should accept the inout input:
- Number of days spent in the hospital, as an integer
- Amount of medication charges
- Amount of surgical charges
- Amount of lab fees
- Amoount of physical rehanilitation charges
The hospital charges $350 per day.
Create the followig functions:
- CalcStayCharges - Calcs and returns the base charges for the hospital stay. This is computed as $350 times the number of days in the hospital
- CalcMiscCharges - Calcs and returns the total of the medication, surgical, lab, and physical rehabilitation charges
- CalcTotalCharges - Calculates and return the total charges
- ValidateInputFields - Checks the vadility of the inout fields by converting each to a numeric value and checking its range. If any inout field id found to be invalid, this function displays an error message and returns a value of False
I am trying to figure out how to set up the form and write the code for chapter 6 programming challene #2 hospital charges in the Starting Out With Visual Basic 2012 (6th Edition).
Thank you for your help.
Explanation / Answer
public class Hospital { List doctorList = new ArrayList(); List patientList = new ArrayList(); String hospitalName; void addDoctor(Doctor o) { doctorList.add(o); } void addPatient(Patient o) { patientList.add(o); } Hospital(String name) { this.hospitalName=name; } public List showDoctors() { return doctorList; } public List showPatients() { return patientList; } public void assignDoctor() { for (Patient x: patientList) { for (Doctor y: doctorList) { if (x.getDisease().equals("eye")) { if (y.getDoctorspeciality().equals("Opthalmologist")) { y.addPatientsToDoctor(x); } } if (x.getDisease().equals("heart patient")) { if (y.getDoctorspeciality().equals("Surgeon")) { y.addPatientsToDoctor(x); } } if (x.getDisease().equals("earnose")) { if (y.getDoctorspeciality().equals("ENT")) { y.addPatientsToDoctor(x); } } } } } }Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.