Académique Documents
Professionnel Documents
Culture Documents
13. Design an algorithm to find the weighted average of four test scores. The four test scores
and their respective weights are given in the following format: testScore1, weightTestScore1
For example, sample data is as follows:
First each test score and its weight is needed. Multiply each test score by its weight and then add the
totals to get the average. See answer below:
Test
Score
75
95
85
65
Weight
Weighted
Average
0.20
0.35
0.15
0.30
15.00
33.25
12.75
19.50
1.00
80.50
Answer:
1. Get testScore1, weightTestScore1
2. Get testScore2, weightTestScore2
3. Get testScore3, weightTestScore3
4. Get testScore4, weightTestScore4
5. sum = testScore1 * weightTestScore1 +
testScore2 * weightTestScore2 +
testScore3 * weightTestScore3 +
testScore4 * weightTestScore4;
14. Given the radius, in inches, and price of a pizza, design an algorithm and write the
pseudocode to find the price of the pizza per square inch.
First, find the area of the pizza. Then divide the total price of the pizza by the area of the pizza.
1. Get the radius of the pizza.
2. Find area of the pizza using following equation:
Area = pi () * radius2
3. Get total price of the pizza.
4. Find the price of the pizza per square inch using following equation:
Pizza price per square inch = Total price of pizza
Area