Pseudocode Activities

Write the following algorithms using pseudocode. Make sure you use the exact syntax and format from the PDF on the previous page (INCLUDING INDENTATION!):

  1. Write the pseudocode for each of the following algorithms:

  2. Write pseudocode algorithms for the following two scenarios:

    1. A customer is purchasing books from an online store. The system should:

      1. Allow the customer to enter the price of each book.

      2. Continue accepting book prices until the customer types "done".

      3. Calculate the total cost of the books.

      4. Apply a 10% discount if the total is over $100.

      5. Display the final amount the customer needs to pay.

    2. A system needs to calculate the sum of numbers from 1 to a given number (N). The algorithm should:

      1. Prompt the user to enter a number, N.

      2. Use a for loop to add all the numbers from 1 to N.

      3. After the loop finishes, print the total sum.

    3. You are creating a system that checks if a user's password is strong:

      1. The program should ask the user to enter a password.

      2. 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.

      3. 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.

Last updated