Extra credit JavaScript problems

  1. Write and test the JavaScript to take in the name of an item, the price and the cost for an item and determine the profit. Put the code in a loop so you can tell the computer how many items you want to process and then do the processing that many times. So, if I say I want to do it for 3 items, I will get prompted for the name, the price and the cost three times and I will determine and display the name, price, cost and profit 3 times. Note that profit will be simply price - cost.
  2. Write and test the JavaScript to take in 4 numeric grades, determine the average and assign a letter grade for the student. Put the code in a loop so you can process 4 students.
  3. Write and test the JavaScript to take in the average pay per hour for the employees in a group. Now take in the name, pay per hour and hours worked (no overtime) for 5 different employees (use a loop to process the employees one by one. Calculate their pay. If it is greater than the average display a message saying pay ok. If it is not greater than the average put in a message saying that the employee needs a raise.
  4. Have a loop to do this 3 times: Input the category, the onhand and the onorder. If the category is A and either onhand is less than 100 or onorder is less than 100, you want to display the word ORDER otherwise you want to display OK.