Having trouble with this assignment. Can someone help me out with this? I don't get it! For my assignment it wants me to create a constructor function name automobile w/ 5 properties. Assign the values of my car to each automobile property. Print to the screen.
This 1st one is what I gather from the book that I need to do. Mind you for some reason they can't put all the steps together on a page so I'd know what it should actually look like...
I've tried a showOrder() method but my book doesn't clearly explain it and I can't get it to work no matter where I try it.
I really appreciate the help that I receive on this forum. Hopefully you guys can help me grasp this stuff over time. This is going to be my last assignment until after the first of the year. Thanks in advance.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Candy Order</title>
</head>
<body>
<script type="text/javascript">
<!--HIDE FROM INCOMPATIBLE BROWSERS
function CandyOrder(customer, candy, boxes) {
this.customerName = customer; //customer name
this.candyType = candy; // chocolate, caramel
this.numBoxes = boxes; // number of boxes
}
function displayCandyOrder() {
document.write("<p>Customer name: " + this.customerName);
document.write("<br />Candy type: " + this.candyType);
document.write("<br />Quantity: " + this.numBoxes + " boxes</p>");
var valentinesDay = new CandyOrder();
valentinesDay.customerName = "Don";
valentinesDay.candyType = "choclate";
valentinesDay.numBoxes = 5;
document.write(<p>Customer name: " + valentinesDay.customerName);
document.write("<br />Candy type: " + valentinesDay.candyType);
document.write("<br />Quantity: " + valentinesDay.numBoxes + " boxes</p>");
// STOP HIDING FROM INCOMPATIBLE BROWSERS -->
</script>
</body>
</html>
Here is what I was planning on using...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Automobile</title>
</head>
<body>
<script type="text/javascript">
<!--HIDE FROM INCOMPATIBLE BROWSERS
function automobile(make, model, year, engine, drive) {
this.make = Jeep;
this.model = Wrangler;
this.year = 2004;
this.engine = 4.0;
this.drive = 4X4;
}
document.write("<p>Vehicle make: " + this.make);
document.write("<br />Vehicle model: " + this.model);
document.write("<br />Vehicle year: " + this.year);
document.write("<br />Vehicle engine: " + this.engine);
document.write("<br />Vehicle drive: " + this.drive + "</p>");
// STOP HIDING FROM INCOMPATIBLE BROWSERS -->
</script>
</body>
</html>