Created
May 11, 2014 20:54
-
-
Save brijeshb42/1cf5b6f63cb327ed90fa to your computer and use it in GitHub Desktop.
ShoeRental
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Shoe Rental</title> | |
<script src="index.js"></script> | |
</head> | |
<body> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
}; | |
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!"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment