SmartExpert

(118)

$30/per page/Negotiable

About SmartExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Accounting,Business & Finance See all
Accounting,Business & Finance,Economics,English,HR Management,Math Hide all
Teaching Since: Apr 2017
Last Sign in: 5 Weeks Ago, 1 Day Ago
Questions Answered: 7559
Tutorials Posted: 7341

Education

  • BS,MBA, PHD
    Adelphi University/Devry
    Apr-2000 - Mar-2005

Experience

  • HOD ,Professor
    Adelphi University
    Sep-2007 - Apr-2017

Category > Information Systems Posted 06 Nov 2017 My Price 12.00

TDB1113 ASSESSMENT 2 STRUCTURED PROGRAMMING SEMESTER

ASSESSMENT #2
TDB1113 STRUCTURED PROGRAMMING
SEMESTER SEPTEMBER 2016
----------------------------------------------------------------------------------------------------------------------------------ANSWER ALL QUESTIONS 1. [4 marks] Given the incomplete main function below:
int main() 
…
admissionType = getPatientData(name, IC);
if (admissionType == 1) 
…
totalCharges = calculateInPatientCharges(…);

else
…
totalCharges = calculateInPatientCharges(…);

…
return 0;

Write a complete C++ program that computes and displays the charges for a patient’s hospital stay.
First, the program uses a function named getPatientData to get patient’s name, IC number and ask if
the patient was admitted as an in-patient or an out-patient. This function receives reference
parameters (name and ic) and returns type of admittance. This function will be called from the main
function.
Then, depending on the type of admittance returned to the main function, if the patient was an inpatient, the following data should be entered (in the main function): The number of days spent in the hospital
Hospital medication charges
Charges for hospital services (lab test, etc) Otherwise, the program should ask for the following data if the patient was an out-patient: Charges for hospital services (lab test, etc.)
Hospital medication charges Then, the program will proceed with the calculation of the total charges for the patient. The calculation
should also be done in a function named calculateInPatientCharges for in-patient or
calculateOutPatientCharges for out-patient. Both functions should return the calculated charges. NOTE: Define the daily hospitalization rate as a constant (e.g., RM50 per day).
Input validation: Do not accept negative numbers for any data. Sample of output screen 2. [2 marks] Write a C++ program that has a main function which calls a recursive
function named count7() to count the occurrences of 7 as a digit in a number n. For
example a number n=717 will yield 2 as a result since 7 appears twice in the number.
[Note that mod (%) by 10 yields the rightmost digit (126 % 10 is 6), while divide (/) by 10
removes the rightmost digit (126 / 10 is 12)].
Below are sample function calls and their expected returned value.
Function call Returned Value =========
count7(717)
count7(7)
count7(123) ==========
2
1
0 *NOTE: sample function prototype: int count7(int n) 3. [2 marks] Write a complete C++ program which uses input text file to read details of
some product shipments. Each shipment contains the shipment ID, number of products
shipped and their total combined values. The program lists the shipments which ship
more than RM100,000 worth of products in an output file.
*NOTE: Sample shipment: S001 3 150000

Answers

(118)
Status NEW Posted 06 Nov 2017 05:11 PM My Price 12.00

TDB-----------111-----------3 A-----------SSE-----------SSM-----------ENT----------- 2 -----------STR-----------UCT-----------URE-----------D P-----------ROG-----------RAM-----------MIN-----------G S-----------EME-----------STE-----------R -----------

Attachments

file 1509993351-TDB1113 ASSESSMENT 2 STRUCTURED PROGRAMMING SEMESTER.docx preview (177 words )
#-----------inc-----------lud-----------e &-----------amp-----------;lt-----------;io-----------str-----------eam-----------&am-----------p;g-----------t; ----------- us-----------ing----------- na-----------mes-----------pac-----------e s-----------td;----------- /-----------/me-----------tho-----------d f-----------or -----------cal-----------icu-----------lat-----------e c-----------har-----------ges----------- fo-----------r i-----------n-p-----------ati-----------ent-----------flo-----------at -----------cal-----------icu-----------lat-----------Cha-----------rge-----------s( -----------int----------- no-----------ofD-----------ays-----------,fl-----------oat----------- da-----------ily-----------Rat-----------e,f-----------loa-----------t m-----------edi-----------cal-----------Cha-----------rge-----------,fl-----------oat----------- ho-----------spi-----------tal-----------Ser-----------vic-----------e){-----------flo-----------at -----------cha-----------rge-----------s=(-----------(fl-----------oat-----------)no-----------ofD-----------ays-----------*da-----------ily-----------Rat-----------e)+-----------med-----------ica-----------lCh-----------arg-----------e+h-----------osp-----------ita-----------lSe-----------rvi-----------ce;-----------ret-----------urn----------- ch-----------arg-----------es;-----------}//-----------met-----------hod----------- fo-----------r c-----------ali-----------cul-----------ate----------- ch-----------arg-----------es -----------for----------- ou-----------t-p-----------ati-----------ent-----------flo-----------at -----------cal-----------icu-----------lat-----------Cha-----------rge-----------s( -----------flo-----------at -----------med-----------ica-----------lCh-----------arg-----------e,f-----------loa-----------t h-----------osp-----------ita-----------lSe-----------rvi-----------ce)-----------{fl-----------oat----------- ch-----------arg-----------es=-----------med-----------ica-----------lCh-----------arg-----------e+h-----------osp-----------ita-----------lSe-----------rvi-----------ce;-----------ret-----------urn-----------
Not Rated(0)