Guest User

Untitled

a guest
Mar 23rd, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title></title>
  5. <script type="text/javascript">
  6. var minHeight = 150;
  7. var maxHeight = 190;
  8.  
  9. var maxAge = 50;
  10. var minAge = 30;
  11.  
  12. var johnHeight = Math.floor(Math.random() * (maxHeight - minHeight) + minHeight);
  13. console.log("John's height is: " + johnHeight);
  14. var markHeight = Math.floor(Math.random() * (maxHeight - minHeight) + minHeight);
  15. console.log("Mark's height is: " + markHeight);
  16. var jamesHeight = Math.floor(Math.random() * (maxHeight - minHeight) + minHeight);
  17. console.log("James' height is: " + jamesHeight);
  18.  
  19. var johnAge = Math.floor(Math.random() * (maxAge - minAge) + minAge);
  20. console.log("John's age is: " + johnAge);
  21. var markAge = Math.floor(Math.random() * (maxAge - minAge) + minAge);
  22. console.log("Mark's age is: " + markAge);
  23. var jamesAge = Math.floor(Math.random() * (maxAge - minAge) + minAge);
  24. console.log("James' age is: " + jamesAge);
  25.  
  26. var totalJohn = johnHeight + johnAge * 5;
  27. console.log("Total points John: " + totalJohn);
  28. var totalMark = markHeight + markAge * 5;
  29. console.log("Total points Mark: " + totalMark);
  30. var totalJames = jamesHeight + jamesAge * 5;
  31. console.log("Total points James: " + totalJames);
  32.  
  33.  
  34. if (totalJohn > totalMark && totalJohn > totalJames) {
  35. console.log("John wins the game with " + totalJohn + " points.");
  36. } else if (totalMark > totalJohn && totalMark > totalJames) {
  37. console.log("Mark wins the game with " + totalMark + " points.");
  38. } else if (totalJames > totalJohn && totalJames > totalMark) {
  39. console.log("James wins the game with " + totalJames + " points.");
  40. } else {
  41. console.log("It's a draw. Nobody wins the game");
  42. }
  43.  
  44.  
  45. </script>
  46. </head>
  47. <body>
  48.  
  49.  
  50.  
  51. </body>
  52. </html>
Add Comment
Please, Sign In to add comment