Pseudocode Activities
Last updated
Last updated
Write the following algorithms using pseudocode. Make sure you use the exact syntax and format from the PDF on the previous page (INCLUDING INDENTATION!):
Write the pseudocode for each of the following algorithms:
Write pseudocode algorithms for the following two scenarios:
A customer is purchasing books from an online store. The system should:
Allow the customer to enter the price of each book.
Continue accepting book prices until the customer types "done".
Calculate the total cost of the books.
Apply a 10% discount if the total is over $100.
Display the final amount the customer needs to pay.
A system needs to calculate the sum of numbers from 1 to a given number (N). The algorithm should:
Prompt the user to enter a number, N.
Use a for loop to add all the numbers from 1 to N.
After the loop finishes, print the total sum.
You are creating a system that checks if a user's password is strong:
The program should ask the user to enter a password.
Use one subroutine called CheckStrength(password)
that:
Ensures the password is at least 8 characters long.
Checks if the password contains at least one number.
Checks if the password contains at least one uppercase letter.
The main program should:
Call CheckStrength(password)
.
If the password is strong, print "Password is strong."
If not, print "Weak password. Try again."
and prompt for a new one.