You are on page 1of 9

THE UNIVERSITY OF DODOMA COLLEGE OF

INFORMATICS AND VIRTUAL EDUCATION


DEPARTMENT OF COMPUTER SCIENCE AND
ENGINEERING
INDIVIDUAL ASSIGNMENT

NAME: JOSEPH BISANDA


REG. NO: T22-03=07381
COURSE NAME: BSC. CSDFE
COURSE CODE: CP 123
SUBMISSION DATE: 12th JUNE 2023.
Qn 1; A program was designed to receive scores of one student in ten
subjects. The program should calculate and display the sum and average
score of one student.
From this scenario;
(i) Write an algorithm pseudocode or flow chart to design the
program.
(ii) Use C++ program to implement the program.

ANSWERS;

(i) Initialize a variable sum to 0.


For i=1 to 10:
a. Read the score for subject I from the user
b. Add the score to the sum variable
Calculate the average by dividing the sum by 10.
Display the sum and average scores.

(ii)
Qn 2; A program was designed to receive scores of one student in ten
subjects; the program should display the scores, calculate and display
the sum and average score of one student from this scenario.
(i) Write an algorithm in pseudocode or pseudicode or flow chart
to design the program.
(ii) Use a C++ program to implement it.

ANSWER;
(i) Initialize sum to 0.
Initialize average to 0.
Initialize count to 0.
Repeat the following steps
a. Read the score for the subjects.
b. Add the increment score to sum.
c. Increment count by 1.
Calculate the average by dividing sum by count.
Display the sum and average.
(ii)
Qn 3; Write a C++ program for a function calculator.
ANSWER:
Qn 4; Write a C++ program for a function calculator which passes
parameters.
Qn 5; Write a C++ program regarding with file-handling to display five
lines.

You might also like