JavaScript 3

Problem #1: Write the program from the pseudocode in the first problem in the logic assignment and test it to make sure it is running.

  var1 = 10
  var2 = 20
  wksum = 0
  rslt = 0
  do while var2 < 30
     wksum = var1 + var2
     if wksum > 30
        var1 = var1 - 2
        var2 = var2 + 1
        var1 = var1 - 1
        var2 = var2 + 3
     end if
  end while loop
  rslt = var1 + var2
  display rslt

Problem #2: I want you to use a loop to take in 4 scores from a game and calculate the sum and the average. You will need to use a loop and you will need to go through the loop 4 times (use a counter like ct). Inside the loop add to the total so you have the total for the four scores. After the loop ends display the total and display the average. You should also check the average and if it is higher than 80 write a message that says good job otherwise write a message that says you need to try harder.

Problem #3: Redo the program above but instead of doing it 5 times, due it until the total is greater than 1000. I want you to then print out the total, the average and the message.

Problem #4: Redo the program one more time.This time I want you to have a loop that will take in the score and after each entry prompt the user by asking whether they want to enter another score Y or N. When the user ends the loop, print out the average and the message.

Problem #5: 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.