Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
785 views

PseudoCode Exercises

The document lists 14 exercises that can be solved using algorithms in pseudocode, including adding numbers, calculating ages, areas, prices, drawing shapes, calculating totals and taxes from multiple items, searching for objects, selecting the heaviest item, monitoring temperatures and emails, grading tests, and determining the sign of a subtraction result. An algorithm would be needed to generalize the process for any number of items or inputs in the calculations and conditionally perform different actions based on the results.

Uploaded by

lapsa22
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
785 views

PseudoCode Exercises

The document lists 14 exercises that can be solved using algorithms in pseudocode, including adding numbers, calculating ages, areas, prices, drawing shapes, calculating totals and taxes from multiple items, searching for objects, selecting the heaviest item, monitoring temperatures and emails, grading tests, and determining the sign of a subtraction result. An algorithm would be needed to generalize the process for any number of items or inputs in the calculations and conditionally perform different actions based on the results.

Uploaded by

lapsa22
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Write an Algorithm in Pseudocode for the below Exercises

1. Add 5 numbers and display the Total


2. Tell someone how old they will be in 20 years
3. Compute the area of a circle
4. Compute the new price for a product thats on sale for 10% off
5. Draw a 5 inch square on the screen
6. Add the prices of an order of fries, a burger and a drink. Calculate the tax
and tell the customer their total.
a. How would you generalize your algorithm to add up the prices of
any number of items and calculate tax and a total (assume that ALL
items are taxable)
7. Search for a red marble in a box of red, green and yellow marbles
8. Select the heaviest of 5 melons sitting in a fruit bin
9. Check someones email every 5 minutes. Signal them if new mail has
arrived
10. Monitor the temperature in a room every 10 minutes. Turn on the A/C if
the temperature is 5 degrees above the Thermostat setting
11. Monitor the temperature in a room every 10 minutes. Turn on the heat if
the temperature is 10 degrees above the Thermostat setting
12. Do either (10) or (11) depending on the temperature in the room
13. Mark a 10 question test and compute a grade on a 10-point scale
a. Convert the score to a letter grade based on the following:
i. 90 or 100 = A
ii. 80 = B
iii. 70 = C
iv. Anything else = F
14. Subtract 2 numbers. If the result is positive, say Positive; if the result is
negative, say Negative. If the result is 0, say Zero

You might also like