Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a javascript program that allows the user to enter the number of bowls of

ID: 3813384 • Letter: W

Question

Write a javascript program that allows the user to enter the number of bowls of pho Po ate for each day and each week.

Use html text fields () to capture the number of weeks and the number of days per week.                                                                (4 points)

The user should be allowed to enter the number of bowls of pho for each day of each week.

The output should look like the example output shown.(1 point each, total 3 points)

The program should also calculate Po’s total number of bowls of pho, subtotal number of bowls of pho for each week, and the day with the largest number of bowls of pho for each week. Your output should follow the example output format given.(3 points each, total 12 points)

You must use nested loops (for, or while, or do..while or mixing them) to solve the problem.
(-15 points if not)

Example Input:

EXAMPLE OUTPUT

Richard Ricardo's Kung Fu Panda Po Weekly Pho Log Number of weeks Po was on pho holiday: 2 Number of days Po ate pho each week: E Enter the number of bowls of pho ate each day/week

Explanation / Answer

Hi, Please find below the entire html file along with the javascript functions implement the above stated logic: (No CSS was included, as it was not explicitly mentioned). Thank you.

-----------------------------------------------------------------------------------------------------------------------------------------------------

<html>
   <head>
      
   </head>
  
   <body>

       <h2 align="center">Richard Ricardo's Kung Fu Panda Po Weekly Pho Log</h2>
  
       Number of weeks po was on pho holiday <input type = "text" id = "weeksCount"><br>
       Number of days po ate pho each week <input type = "text" id = "daysCount"> <br>

       <br><br>

       <button type = "button">Enter the number of bowls of pho ate each day/week </button><br><br>

       Po was on holiday for <span id = "weeks"></span> weeks, and spent <span id = "days"></span> days per week eating.

       <div id= "details"></div>
      
       <script>              
           var weeks;
           var days;
           var i,j;
           var detail_string = "<br><br>";
           var greaterBowls ;
           var greaterDay ;
           var subTotal;
           var total = 0;
           function weeksFunction()
           {
               weeks = document.getElementById("weeksCount").value;
               document.getElementById("weeks").innerHTML = weeks;
           }

           function daysFunction()
           {
               days = document.getElementById("daysCount").value;
               document.getElementById("days").innerHTML = days;
           }      
          
           function bowlsCount()
           {
               for(i = 0; i < weeks ; i++)
               {
                   detail_string += "WEEK "+ (i+1) + "<br>";
                   greaterBowls = 0;
                   greaterDay = 0;
                   subTotal = 0;
                  
                   for(j = 0; j < days; j++)
                   {
                       var bowls = prompt("Enter the number of bowls of pho ate for week "+(i+1)+", day "+(j+1)+".");
                       if(greaterBowls < bowls)
                       {
                           greaterBowls = bowls;
                           greaterDay = (j+1);
                       }
                       subTotal = subTotal + parseInt(bowls);
                       detail_string += "Number of bowls of pho for day "+ (j+1) +"= "+bowls+ " bowls <br>";
                      
                      
                   }

               detail_string += "Week "+(i+1)+"'s subtotal is "+subTotal+" bowls of pho<br>";
               total = total + subTotal;
               detail_string += "Week "+(i+1)+"'s largest day (number of bowls of pho) is "+greaterBowls+" bowls, happens on day "+ greaterDay + ".<br><br>";
               }
               detail_string += "The total number of bowls of pho for these weeks = "+total+" bowls of pho";

               document.getElementById("details").innerHTML = detail_string;
           }
          
          
       </script>
      
   </body>
</html>

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote