Advertisement
Guest User

Untitled

a guest
Aug 31st, 2015
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.03 KB | None | 0 0
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <title>TopPot Donughnuts</title>
  5. <!-- <link rel="stylesheet" href="name of file" /> -->
  6. <link rel="stylesheet" href="hw5-CSS-topPotTemplate.css">
  7. <body>
  8. <!-- Nav -->
  9. <nav id="nav">
  10. <ul>
  11. <!-- href="link" -->
  12. <li><a href="#ourStory">Our Story</a></li>
  13. <li><a href="#donuts">Donuts</a></li>
  14. <li><a href="#coffee">Coffee</a></li>
  15. <li><a href="#contact us">Contact us</a></li>
  16. </ul>
  17. </nav>
  18.  
  19. <!-- Home -->
  20. <header class= "page-header">
  21. <h1>Welcome to<strong><em> TopPot </em></strong> Doughnuts.</h1>
  22. </header>
  23.  
  24. <p>Top Pot Doughnuts invites you to join us on our <strong><em>delicious</em></strong> journey of good taste. From our uniquely designed cafes to our hand-roasted coffee and hand-forged gourmet doughnuts, we are committed to doing things the old fashioned way beautifully, warmly, and with unfailing attention to details.</p>
  25.  
  26. <a href="#calculate" class="big_button">Click for Shops</a>
  27.  
  28. <table id='myTable' border = '2'>
  29.  
  30. <tr class='container'>
  31. <th scope='col'>Location</th>
  32. <th scope='col'>Average Donuts/Day</th>
  33. <th scope='col'>Total Donuts/Hour</th>
  34. </tr>
  35.  
  36. <tr>
  37. <th scope="row">Downtown</th>
  38. <td>971</td>
  39. <td>59</td>
  40. </tr>
  41.  
  42. <tr>
  43. <th scope="row">Capitol Hill</th>
  44. <td>504</td>
  45. <td>51</td>
  46. </tr>
  47.  
  48. <tr>
  49. <th scope="row">South Lake Union</th>
  50. <td>873</td>
  51. <td>124</td>
  52. </tr>
  53.  
  54. <tr>
  55. <th scope="row">Wedgewood</th>
  56. <td>300</td>
  57. <td>21</td>
  58. </tr>
  59.  
  60. <tr>
  61. <th scope="row">Ballard</th>
  62. <td>1335</td>
  63. <td>97</td>
  64. </tr>
  65.  
  66. </table>
  67. <script>
  68. // constructor function
  69. var DonutShop = function(location, minCstmr, maxCstmr, avgDonutsPerCstmr, hoursOfOp) {
  70. this.location = location;
  71. this.minCstmr = minCstmr;
  72. this.maxCstmr = maxCstmr;
  73. this.avgDonutsPerCstmr = avgDonutsPerCstmr;
  74. this.hoursOfOp = hoursOfOp;
  75.  
  76. this.getDonutsPerHour = function() {
  77. var answer = (Math.floor(Math.random() * (this.maxCstmr-this.minCstmr) + this.minCstmr) * this.avgDonutsPerCstmr);
  78. return answer;
  79. }
  80.  
  81. this.getDonutsPerDay = function() {
  82. var answer = this.getDonutsPerHour() * hoursOfOp;
  83. return answer;
  84. }
  85. };
  86.  
  87. // var downtown = new DonutShop("Downtown", 8, 43, 4.5, 8);
  88. // var capHill = new DonutShop("Capitol Hill", 4, 37, 2, 8);
  89. // var slu = new DonutShop("South Lake Union", 9, 23, 6.33, 10);
  90. // var wedgewood = new DonutShop("Wedgewood", 2, 28, 1.25, 10);
  91. // var ballard = new DonutShop("Ballard", 8, 58, 3.75, 8);
  92.  
  93. // console.log(downtown.getDonutsPerDay());
  94. // console.log(downtown.getDonutsPerHour());
  95.  
  96. // console.log(capHill.getDonutsPerDay());
  97. // console.log(capHill.getDonutsPerHour());
  98.  
  99. // console.log(slu.getDonutsPerDay());
  100. // console.log(slu.getDonutsPerHour());
  101.  
  102. // console.log(wedgewood.getDonutsPerDay());
  103. // console.log(wedgewood.getDonutsPerHour());
  104.  
  105. // console.log(ballard.getDonutsPerDay());
  106. // console.log(ballard.getDonutsPerHour());
  107.  
  108. var DonutMaster = function(){
  109. this.shops = [];
  110. this.addShop = function(location, minCstmr, maxCstmr, avgDonutsPerCstmr, hoursOfOp){
  111. var newDonutShop = new DonutShop(location, minCstmr, maxCstmr, avgDonutsPerCstmr, hoursOfOp);
  112. this.shops.push(newDonutShop);
  113. }
  114. this.generateReport = function(){
  115. for(var i=0; i<this.shops.length; i++){
  116. console.log("This Location: " + this.shops[i].location + " sells " + this.shops[i].getDonutsPerHour() + " donuts per hour and sells " + this.shops[i].getDonutsPerDay() + " donuts per hour.\n");
  117.  
  118. }
  119. }
  120. }
  121.  
  122. var master = new DonutMaster();
  123. master.addShop("Downtown", 8, 43, 4.5, 8);
  124. master.addShop("Capitol Hill", 4, 37, 2, 8);
  125. master.addShop("South Lake Union", 9, 23, 6.33, 10);
  126. master.addShop("Wedgewood", 2, 28, 1.25, 10);
  127. master.addShop("Ballard", 8, 58, 3.75, 8);
  128.  
  129. master.generateReport();
  130.  
  131. </script>
  132. </body>
  133. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement