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;
Geschreven voor
- Instelling
- University of South Africa
- Vak
- COS1512
Documentinformatie
- Geüpload op
- 22 oktober 2021
- Aantal pagina's
- 11
- Geschreven in
- 2021/2022
- Type
- Tentamen (uitwerkingen)
- Bevat
- Vragen en antwoorden
Onderwerpen
-
cos1512
-
cos1512 assignment 1