Rev A Lab 5
All programs (problems 3-5) to be handed in should include both source code and resulting output on the same page.
13 28 D
14 E 98
A B 56
What value (if any) is assigned to x, y, and ch after each of the following statements executes? (Use the same input for each statement.)
a. cin>>x>>y;
cin.ignore(50,’\n’);
cin>> ch;
b. cin>>x;
cin.ignore(50,’\n’);
cin>>y;
cin.ignore(50,’\n’);
cin.get(ch);
c. cin>>y;
cin.ignore(50,’\n’);
cin>>x>>ch;
d. cin.get(ch);
cin.ignore(50,’\n’);
cin>>x;
cin.ignore(50,’\n’);
cin>>y;
cin>>age;
cin.get(ch);
getline(cin, name);
if the input is:
a. 35 John Doe
b. 35
John Doe
a) prompts the
user to input 3 decimal numbers (with a fraction part)
b) Prints the
three decimal numbers.
c) Converts each
decimal number to the nearest integer.
d)
Prints the three
converted numbers.
e)
Computes and prints the
sum and average of the three integers.
12345678901234567890123456789012345
************************************************
Federal Income Tax: 15%
State Tax: 3.5%
Social Security Tax: 5.75%
Medicare/Medicaid Tax: 2.75%
Pension Plan: 5%
Health Insurance: $75.00
Your program should prompt
the user to input the gross amount and the employee name. Format your output to have two decimal
places> A sample output
follows: The program should produce
this type of output both on the display monitor and to a data file
c:\lab5_data.txt.
John Doe
Gross Amount: ………… $3575.00
Federal Income Tax: ……. $ 536.25
State Tax: …………. ……. $ 125.13
Social Security Tax: ……… $
205.56
Medicare/Medicaid Tax: .. $
98.33
Pension Plan: ……………...$
178.75
Health Insurance: ………….
$ 75.00
Net Pay ……………………. $2356.00
Note that the first column is
left-justified and the right column is right-justified.