Usetutoringspotscode to get 8% OFF on your first order!

  • time icon24/7 online - support@tutoringspots.com
  • phone icon1-316-444-1378 or 44-141-628-6690
  • login iconLogin

JavaScript lab

Write JavaScript Programs to do the following:(jsps2)

(1) Create a change-counting game that gets the user to enter the number of coins required to make exactly one dollar. The program should prompt the user to enter the number of pennies, nickels, dimes, and quarters. If the total value of the coins entered is equal to one dollar, the program should congratulate the user for winning the game. Otherwise, the program should display a message indicating whether the amount entered was more than or less than one dollar.

(2) A software company sells a package that retails for $100. Quantity discounts are given according to the following table:

Quantity Discount
1019    10%
2049    20%
5099    30%
100+      40%
Write a program that asks the user to enter the number of packages purchased. The program should then display the amount of the discount (if any) and the total amount of the purchase after the discount.

(3) Write a program that asks the user to enter a number of seconds and works as follows:

There are 60 seconds in a minute. If the number of seconds entered by the user is greater than or equal to 60, the program should display the number of minutes in that many seconds.
There are 3,600 seconds in an hour. If the number of seconds entered by the user is greater than or equal to 3,600, the program should display the number of hours in that many seconds.
There are 86,400 seconds in a day. If the number of seconds entered by the user is greater than or equal to 86,400, the program should display the number of days in that many seconds.
(4) The colors red, blue, and yellow are known as the primary colors because they cannot be made by mixing other colors. When you mix two primary colors, you get a secondary color, as shown here:

When you mix red and blue, you get purple.
When you mix red and yellow, you get orange.
When you mix blue and yellow, you get green.
Design a program that prompts the user to enter the names of two primary colors to mix. If the user enters anything other than red, blue, or yellow, the program should display an error message. Otherwise, the program should display the name of the secondary color that results.

Write JavaScript programs to do the following:(jsps4)

(1) A county collects property taxes on the assessment value of property, which is 60 percent of the propertys actual value. For example, if an acre of land is valued at $10,000, its assessment value is $6,000. The property tax is then 72 for each $100 of the assessment value. The tax for the acre assessed at $6,000 will be $38.40. Write a function that accepts the actual value of a piece of property and displays the assessment value and property tax.

(2) Suppose you deposit a certain amount of money into a savings account that earns compound monthly interest, and you want to calculate you will have after a specific amount number of months. The formula is:
F = P * (1 + i)t

Where the terms in the formula are as follows:
F is the future value of the account after the specified amount of time.
P is the present value, or the amount that you want deposit.
i is the monthly interest rate.
t is the number of months that you plan to let the money sit in the account.
Write a function called futureValue() that takes on three arguments: P, i and t which returns the future value.

(3) Write a program that asks the user to enter five test scores. The program should display letter grade for each score and the average test score. Write the following functions in the program:

calcAverageThis function should accept five test scores as arguments and return the average of the scores.
determineGradeThis function should accept a test score as an argument and return a letter grade for the score based on the following grading scale:
Score    Letter Grade
90100    A
8089    B
7079    C
6069    D
Below 60    F
(4) A painting company has determined that for every 112 square feet of wall space, one gallon of paint and eight hours of labor will be required. The company charges $35.00 per hour for labor and $15.00 for a gallon of paint. Write a function that takes in the number of square feet of wall space and displays the following data:

The number of gallons of paint required
The hours of labor required
The cost of the paint
The labor charges
The total cost of the paint job

You can leave a response, or trackback from your own site.

Leave a Reply

Powered by WordPress | Designed by: Premium WordPress Themes | Thanks to Themes Gallery, Bromoney and Wordpress Themes