JavaScript Assignment #3

  1. Write the program to solve the problem shown in problem #1 in the Logic Assignment from week four.
    start
      var1 = 10
      var2 = 20
      wksum = 0
      rslt = 0
      do while var2 < 30
         wksum = var1 + var2
         if wksum > 30
            var1 = var1 - 2
            var2 = var2 + 1
         else
            var1 = var1 - 1
            var2 = var2 + 3
         end if
      end while loop
      rslt = var1 + var2
      display rslt
    end  
    
  2. Write the code to first take in how much money you are willing to spend today. Then use a loop to take in a series of purchases - input the price and the item name. Stop the loop when you have spent over the money you are willing to spend.
  3. You have a product that is on sale. Each day of the sale, the price drops 10% from its previous price. The sale lasts for 4 days. You should write a program that processes this problem using a loop. Each pass through the loop should generate the sale price for a a day of the sale and display that price along with the day number.
  4. You are depositing money to an account. You deposit different amounts each week. No deposit can be over $200. When you have deposited $500 you want to end the program and tell how many weeks it took to reach the goal and the total amount of the deposits.
  5. Write the program to play the Rock, Paper, Scissors game. A game is one random guess by the computer compared to user input. Write the program so the user can choose to play again or quit. Your program should be unique and not similiar to any solutions found on the web. It should follow the style we have used in class.