Advertisement
Guest User

Untitled

a guest
Aug 29th, 2015
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.01 KB | None | 0 0
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <title>TopPot Donughnuts</title>
  5. <!-- <link rel="stylesheet" href="name of file" /> add name later-->
  6. </head>
  7. <body>
  8. <!-- Nav -->
  9. <nav id="nav">
  10. <ul class="container">
  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>
  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. <a href="#calculate" class="big button">Click for Shops</a>
  26.  
  27. <table id='myTable' border = '2'>
  28.  
  29. <tr class='container'>
  30. <th scope='col'>Location</th>
  31. <th scope='col'>Average Donuts/Day</th>
  32. <th scope='col'>Total Donuts/Hour</th>
  33. </tr>
  34.  
  35. <tr>
  36. <th scope="row">Downtown</th>
  37. <td>971</td>
  38. <td>59</td>
  39. </tr>
  40.  
  41. <tr>
  42. <th scope="row">Capitol Hill</th>
  43. <td>504</td>
  44. <td>51</td>
  45. </tr>
  46.  
  47. <tr>
  48. <th scope="row">South Lake Union</th>
  49. <td>873</td>
  50. <td>124</td>
  51. </tr>
  52.  
  53. <tr>
  54. <th scope="row">Wedgewood</th>
  55. <td>20</td>
  56. <td>21</td>
  57. </tr>
  58.  
  59. <tr>
  60. <th scope="row">Ballard</th>
  61. <td>1335</td>
  62. <td>97</td>
  63. </tr>
  64.  
  65. </table>
  66. <script>
  67. // constructor function
  68. var DonutShop = function(location, minCstmr, maxCstmr, avgDonutsPerCstmr, hoursOfOp) {
  69. this.location = location;
  70. this.minCstmr = minCstmr;
  71. this.maxCstmr = maxCstmr;
  72. this.avgDonutsPerCstmr = avgDonutsPerCstmr;
  73. this.hoursOfOp = hoursOfOp;
  74.  
  75. this.getDonutsPerHour = function() {
  76. var answer = (Math.floor(Math.random() * (this.maxCstmr-this.minCstmr) + this.minCstmr) * this.avgDonutsPerCstmr);
  77. return answer;
  78. }
  79.  
  80. this.getDonutsPerDay = function() {
  81. var answer = this.getDonutsPerHour() * hoursOfOp;
  82. return answer;
  83. }
  84. };
  85.  
  86. // var downtown = new DonutShop("Downtown", 8, 43, 4.5, 8);
  87. // var capHill = new DonutShop("Capitol Hill", 4, 37, 2, 8);
  88. // var slu = new DonutShop("South Lake Union", 9, 23, 6.33, 10);
  89. // var wedgewood = new DonutShop("Wedgewood", 2, 28, 1.25, 10);
  90. // var ballard = new DonutShop("Ballard", 8, 58, 3.75, 8);
  91.  
  92. // console.log(downtown.getDonutsPerDay());
  93. // console.log(downtown.getDonutsPerHour());
  94.  
  95. // console.log(capHill.getDonutsPerDay());
  96. // console.log(capHill.getDonutsPerHour());
  97.  
  98. // console.log(slu.getDonutsPerDay());
  99. // console.log(slu.getDonutsPerHour());
  100.  
  101. // console.log(wedgewood.getDonutsPerDay());
  102. // console.log(wedgewood.getDonutsPerHour());
  103.  
  104. // console.log(ballard.getDonutsPerDay());
  105. // console.log(ballard.getDonutsPerHour());
  106.  
  107. var DonutMaster = function(){
  108. this.shops = [];
  109. this.addShop = function(location, minCstmr, maxCstmr, avgDonutsPerCstmr, hoursOfOp){
  110. var newDonutShop = new DonutShop(location, minCstmr, maxCstmr, avgDonutsPerCstmr, hoursOfOp);
  111. this.shops.push(newDonutShop);
  112. }
  113. this.generateReport = function(){
  114. for(var i=0; i<this.shops.length; i++){
  115. 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");
  116.  
  117. }
  118. }
  119. }
  120.  
  121. var master = new DonutMaster();
  122. master.addShop("Downtown", 8, 43, 4.5, 8);
  123. master.addShop("Capitol Hill", 4, 37, 2, 8);
  124. master.addShop("South Lake Union", 9, 23, 6.33, 10);
  125. master.addShop("Wedgewood", 2, 28, 1.25, 10);
  126. master.addShop("Ballard", 8, 58, 3.75, 8);
  127.  
  128. master.generateReport();
  129.  
  130. </script>
  131. </body>
  132. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement