Beruflich Dokumente
Kultur Dokumente
Exercises
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.
b.
3:7 Suppose that age is a variable of the type int and name is a
variable of the type string. What are the values of age and
name after the following input statements execute?
a.
b.
35 Mickey Balto
35
Mickey Balto
a.
b.
c.
d.
value =
cout <<
cout <<
cout <<
}
void test(int first, int& second)
int third;
//line 5
u = u + pow(3, 3);
cout << "Line 7: u = " << u << endl;
//line 6
//line 7
x = -15;
cout << "Line 9: Absolute value of " << x
<< " = " << abs(x) << endl;
//line 8
return 0;
}
//line 9
Programming Exercises
2.9Write a program that does the following:
a. Prompts the user to input five decimal numbers.
b. Print the five decimal numbers.
c. Converts each decimal numbers to the nearest integer.
d. Adds the five integers.
e. Prints the sum and average of the five integers.
3:4 Write a program to calculate the property tax. Property tax is
calculated on 92% of the assessed value of the property. For
example, if the assessed value is $100000, the property tax is on
$92000. Assume that the property tax rate is $1.05 for each $100 of
the assessed value. Your program should prompt the user to enter the
assessed value of the property. Store the output in a file in the
following format. (Here is a sample output.)
Assessed Value:
Taxable Amount:
Tax Rate for each $100.00:
Property Tax:
100000.00
92000.00
1.05
966.00
Format your output to have two decimal places. (Note that the left
column is left justified and the right column is right-justified.)