Cos1512 -Assignment 1
COS1512 -ASSIGNMENT 1 Question 1 INPUT: #include iostream using namespace std; void calcCharges(int daysInHospital, double dayRate, double mediCharges, double serviceCharges) { double totalCharges; totalCharges = ((daysInHospital * dayRate) + mediCharges + serviceCharges); (ios::fixed); (ios::showpoint); sion(2); cout "The Total Charges for hospital stay is: R" totalCharges; } int main() { int daysInHospital; double dayRate, mediCharges, serviceCharges; char patientType; cout "*** CHARGES FOR PATIENT HOSPITAL STAY ***" endl endl; cout "Was the patient admitted as an in-patient? (y or n)" endl; cin patientType; if (patientType == 'y' || patientType == 'Y') { cout "Number of days spent in hospital: "; cin daysInHospital; cout "Daily Rate: R"; cin dayRate; cout "Hospital Medication Charges: R"; cin mediCharges; cout "Charges for hospital services: R"; cin serviceCharges; calcCharges(daysInHospital, dayRate, mediCharges, serviceCharges); } else { cout "Hospital Medication Charges: R"; cin mediCharges; cout "Charges for hospital services: R"; cin serviceCharges;
Información del documento
- Subido en
- 22 de octubre de 2021
- Número de páginas
- 11
- Escrito en
- 2021/2022
- Tipo
- Examen
- Contiene
- Preguntas y respuestas