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

This is a javaScript front-end web development Cost Estimator – Design a program

ID: 3703660 • Letter: T

Question

This is a javaScript front-end web development

Cost Estimator –

Design a program with a function. The function should calculate the cost of painting rooms in the house. Assume each room can be painted by exactly one can of paint.

Function:

Will have parameters for number of rooms and cost per can

Calculates and returns the cost

Main Code (Inline):

Prompt the user for cost and number of rooms

Call the function, pass the 2 arguments and have the value displayed on the web page

MPG Estimator –

Design a program with a function. The function should calculate the MPG (mile-per-gallon) of the car.

Function:

Will have parameter for size of gas tank and miles drivable on a full tank (range)

Will calculate and return the MPG (Mile/gallon)

Main Code (Inline):

Prompt for size of tank (in gallons0 and miles drivable

Call function, passing 2 arguments (variables form previous step)

Display the returned value

Bill Estimator – Design a program with a function. The function should calculate the total bill of the user. Enter all rates (percentages) as .05 (for 5%)

Function:

Will have parameters for subtotal, tax rate, and tip rate

Will calculate and display to the user the total amount due using the following formula - subtotal * tax rate is tax due; tax due + subtotal is multiplied by tip rate, then add this result to tax due and subtotal for final total

Main Code (Inline):

Prompt for Subtotal, Tax Rate & Tip Rate

Call Function, Pass 3 Arguments

Display the returned value

Rubric

Declare the parameters needed to calculate the program

Using a function, calculate the required values for the program you selected

Prompt the user in the HTML document to input information to be used in the function

Call the function and send the arguments to be used

Display the returned value to the user in a concatenate statement

Explanation / Answer

1st Part:

<!DOCTYPE html>

<html>

<body>

<p>Cost of painting rooms in the house..</p>

<p id="demo"></p>

<script>

function myFunction(no_of_rooms, cost_per_can) {

total_cost = no_of_rooms * cost_per_can

return total_cost;

}

var rooms = prompt("Enter number of rooms", "0");

var costPerCan = prompt("Enter cost of one can", "0");

document.getElementById("demo").innerHTML = myFunction(rooms, costPerCan);

</script>

</body>

</html>


Part 2nd:

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote