It should come up in an html brower and look like this: Welcome to Lanes Galore
ID: 3556950 • Letter: I
Question
It should come up in an html brower and look like this:
Welcome to Lanes Galore Shoe Rentals
Renter's name:
Shoe ID:
Shoe size:
Rental date:
Rental time:
Number of games bowled:
Cost of rental:
Thank you!
<html>
<head>
<script type="text/javascript">
function ShoeRental(){
/*var shoeID,shoeSize;
var firstName, lastName;
var rentalDate, rentalTime;
var numGames, rentalCost;*/
function computeRentalCost(games){
var COST_PER_GAME = 2;
var cost;
cost = games * COST_PER_GAME;
return cost;
};
</head>
<body>
this.shoeID = parseInt(prompt("Enter the shoe ID number:"));
this.shoeSize = parseInt(prompt("Enter the shoe size:"));
this.firstName = prompt("Enter renter's first name:");
this.lastName = prompt("Enter renter's last name:");
this.rentalDate = prompt("Enter date (MM/DD/YYYY):");
this.rentalTime = prompt("Enter time (HH:MM):");
this.numGames = parseInt(prompt("How many games is renter bowling?"));
this.rentalCost = computeRentalCost(this.numGames);
}
ShoeRental.prototype.displayInfo = function(){
document.writeln("Renter's name:" + this.firstName + " " + this.lastName+"<br />");
document.writeln("Shoe ID:" + this.shoeID+"<br />");
document.writeln("Shoe size: " + this.shoeSize+"<br />");
document.writeln("Rental date: " + this.rentalDate+"<br />");
document.writeln("Number of games bowled: " + this.numGames+"<br />");
document.writeln("Cost of rental: " + this.rentalCost +"<br />");
};
var nextCustomer = new ShoeRental();
nextCustomer.displayInfo();
document.writeln("Thank you!");
</body>
</html>
Explanation / Answer
<html>
<head>
<title>test</title>
<script type="text/javascript">
function computeRentalCost(games)
{
var COST_PER_GAME = 2;
var cost;
cost = games * COST_PER_GAME;
return cost;
}
function ShoeRental()
{
this.shoeID = parseInt(prompt("Enter the shoe ID number:"));
this.shoeSize = parseInt(prompt("Enter the shoe size:"));
this.firstName = prompt("Enter renter's first name:");
this.lastName = prompt("Enter renter's last name:");
this.rentalDate = prompt("Enter date (MM/DD/YYYY):");
this.rentalTime = prompt("Enter time (HH:MM):");
this.numGames = parseInt(prompt("How many games is renter bowling?"));
this.rentalCost = computeRentalCost(this.numGames);
}
ShoeRental.prototype.displayInfo = function()
{
document.writeln("Renter's name:" + this.firstName + " " + this.lastName+"<br />");
document.writeln("Shoe ID:" + this.shoeID+"<br />");
document.writeln("Shoe size: " + this.shoeSize+"<br />");
document.writeln("Rental date: " + this.rentalDate+"<br />");
document.writeln("Number of games bowled: " + this.numGames+"<br />");
document.writeln("Cost of rental: " + this.rentalCost +"<br />");
}
var nextCustomer = new ShoeRental();
nextCustomer.displayInfo();
document.writeln("Thank you!");
</script>
</head>
<body>
</body>
</html>
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.