Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

WRITE IN JAVA SCRIPT. You are given the task of calculating a telephone bill. Be

ID: 667750 • Letter: W

Question

WRITE IN JAVA SCRIPT. You are given the task of calculating a telephone bill. Begin the program with an alert to welcome the user to the program. Here are the tasks that must be completed. Ask the user for the number of minutes the person used the phone. Ask the user for the per minute rate Be sure to convert each of the numbers received from the prompt statements because they are string and must be converted to numbers. Calculate the cost (# of minutes the person used the phone # per minute rate) Use a confirm method to ask the user ^''Add city tax?^'' If the user selects ^''OK^'' you will calculate the city tax by multiplying the cost by 12% and display the results. If the user selects ^''Cancel^'' you will display an alert stating ^''No city tax^''. Use a confirm method to ask the user ^''Is there is a charge for line maintenance?^'' If the user selects ^''OK^'' you will add dollar5 to the total cost. If the user selects ^''Cancel^'' you will display an alert stating ^''No line maintenance^''. The output for the program should look like Telephone Bill # of minutes used: 3000 Rate per minute: .02 Cost dollar60.00 City Tax: dollar7.20 Line maintenance: dollar5.00

Explanation / Answer

alert("welcome")

minutes=parseFloat(prompt("enter the values in minutes"))

rate = parseFloat(prompt("enter the rate"))

cost = minutes*rate

var p = confirm("add city tax")

if(p)

var q=0.12*cost

else

alert("no city tax")

var p = confirm("Is there a charge for line maintenance")

if(p)

cost=cost+5

else

alert("No line maintenance")