Académique Documents
Professionnel Documents
Culture Documents
Back page:
Course Code
Course Title
Students Registration Name
Students Registration Number
List of References
Submit the hardcopy of your work with screen shot/captured program outputs
Total marks: 40
1. Draw a complete [start end] flowchart of the following nested loop statement and
implement the code in C++
if(grade>0 && grade<40)
cout<<"Fail\n";
else if (grade>=40 && grade<50)
cout<<"Pass\n";
else if (grade>=50 && grade<60)
cout<<"Second Lower Division\n";
else if (grade>=60 && grade<70)
cout<<"Second Upper Division\n";
else if (grade>=70 && grade<101)
(10Mks)
2. Suppose
x = 10 and y = 3
Write a C++ program to output the reminder of x divided by y
(5 Mks)
3. Write a program that calculates the running average of the numbers entered by the user.
The user should enter -1 when he has entered all the numbers he wants averaged; your
program should display the average on the screen. Use comments appropriately. (10Mks)
4. Write a C++ program to find the area and volume of a sphere of given radius. (5Mks)
5. Input to a payroll program consists of base pay rate,. Write a program to compute an
employees gross pay, with holding tax and net pay and print these results. The
withholding tax is the product of the gross pay and the tax rate. The tax rate is found in
the following table:
GROSS PAY
TAX RATE
%
Less than Kshs. 6000
Kshs. 6000 but less than Kshs. 7500
Kshs. 7500 but less than Kshs. 9000
Kshs. 9000 but less than Kshs. 10500
Kshs. 10500 or more
0
8
12
15
17.5
The net pay is computed by subtracting the with_holding tax from the grass pay. (10Mks)