Question

In: Computer Science

After reading chapter 5 of the textbook and watching the video “JavaScript Loops” JavaScript Loops and...

After reading chapter 5 of the textbook and watching the video “JavaScript Loops” JavaScript Loops and “JavaScript Decision Statements” 11 JavaScript Decision Statements

Create a html web page that allows the coach of a town’s soccer league to enter the ages of all the children who have registered for soccer this year. Children between the ages of 4 and 15 are allowed to sign up for soccer but there can be a lot of variation in the number of children who sign up each year and their ages. Eventually the children will be placed into one of three leagues: Junior, Intermediate, and Senior. The Junior League is for children ages 4–7, the Junior League is for children ages 8–11, and the Senior League is for children ages 12–15. The coach wants to know how many children will be in each group. Your program should allow the coach to enter the ages of as many children as desired and should keep track of how many are in each group. The final display should tell the coach how many children signed up and how many will be in each group. Save your page as soccer.html and be sure to include an appropriate page title.


Please upload a screenshot of the working program along with a zipped folder with the .HTML file and any other files or pictures.

Solutions

Expert Solution

CODE:

soccer.html

<!DOCTYPE html>
<html>
<head>
   <title>Town's soccer league</title>
</head>
<body >
       <input type="number" id="age" />
       <input type="button" onclick="handleregister()" value="Register">
   <br>
   Number of students:<p id="total">0</p>
   Number of Juniors<p id="junior">0</p>
   Number of intermediates<p id="intermediate">0</p>
   Number of seniors<p id="senior">0</p>

   <script>
       function handleregister() {
           var count=0;
           var age =document.getElementById('age').value;
           var total=parseInt(document.getElementById("total").innerHTML);
           //alert("total"+total);
           if(age>=4 && age<=7)
           {
               var value=parseInt(document.getElementById("junior").innerHTML);
               count+=1;
               document.getElementById("junior").innerHTML = value+1;

               //alert("junior");
           }
           if(age>=8 && age<=11)
           {
               var value=parseInt(document.getElementById("intermediate").innerHTML);
               count+=1;
               document.getElementById("intermediate").innerHTML = value+1;
           }
           if(age>=12 && age<=15)
           {
               var value=parseInt(document.getElementById("senior").innerHTML);
               count+=1;
               document.getElementById("senior").innerHTML = value+1;
           }
               document.getElementById("total").innerHTML = total+count;


       }
   </script>

</body>
</html>

OUTPUT:

If you have any doubts please COMMENT....

If you understand the answer please give THUMBS UP....


Related Solutions

After reading chapter 7 of the textbook and watching the videos “JavaScript Tutorial - Dice Roll...
After reading chapter 7 of the textbook and watching the videos “JavaScript Tutorial - Dice Roll Programming For Web Browser Games JavaScript Tutorial - Dice Roll Programming For Web Browser Games or “Make a JavaScript Dice Game” Make a JavaScript Dice Game Create a page that allows the user to play a game with the computer. In this game, the player will roll two dice and the computer will roll two dice. The Math.random() method will be used to generate...
After watching the video "Electronic Cigarettes and Vaping," and reading the articles "Quick Facts on the...
After watching the video "Electronic Cigarettes and Vaping," and reading the articles "Quick Facts on the Risks of E-cigarettes for Kids, Teens, and Young Adults" and "Vaping Devices (Electronic Cigarettes)" answer the following questions: a) What did you learn from the video and articles? b) What effect does electronic cigarettes/vaping have on your body? c) If a family member/friend asks you if it's safe to vape what would you answer? Provide support for you answer using information from the video...
After watching the short video clip and reading "What is Strategy" by Michael Porter, discuss what...
After watching the short video clip and reading "What is Strategy" by Michael Porter, discuss what you think his main point is. Do you agree with what he is saying? Why? Do you think that his comments are relevant in today's business climate?
After reading Chapter 3 of the text and watching the tutorial videos below, craft an initial...
After reading Chapter 3 of the text and watching the tutorial videos below, craft an initial post that answers the following questions: What are the possible reasons why the government may make a market intervention? What are the possible implications of such interventions? How might the wedge between consumers and firms lead to market distortions?
After reading Chapter 9 of the textbook, discuss the following questions to the best of your...
After reading Chapter 9 of the textbook, discuss the following questions to the best of your abilities: -Let's pretend that you recently moved from Italy to the United States. How can you adjust to a new society and connect to people in a different community? -In your own words, state what does “living in a diverse world” mean to you? -Name two positive effects and two negative effects of using communication technology. -Define “prejudice” and name three causes of prejudice....
After reading the chapter in your textbook, focus on documentation and informatics. Think about the principles...
After reading the chapter in your textbook, focus on documentation and informatics. Think about the principles of reporting and documentation. Identify and briefly discuss three challenges a nurse has in ensuring accurate and confidential documentation. Then discuss what actions a nurse can take to overcome these challenges including how informatics might make a difference.
Define Instructions: After reading Chapter 4 of the textbook, define the following terms: -System of linear...
Define Instructions: After reading Chapter 4 of the textbook, define the following terms: -System of linear equations -Solution to a system of equations -Consistent system of equations -Inconsistent system of equations Write a good paragraph with at least 5 sentences using a minimum of 75 words.
Part 1: Marketing & Community Relations: After reading chapter 16 of your textbook, you are to...
Part 1: Marketing & Community Relations: After reading chapter 16 of your textbook, you are to use the Internet and research a long-term care facility in your area. After studying the organization, you are to address the following questions: a. How does the facility “brand” its product? b. Does the long-term care facility engage in community involvement? 3. Your initial response must be 250 words in length and posted on or before Wednesday.
After listening to the Crash Course video below and reading Chapter 28 on fiscal policy, discuss...
After listening to the Crash Course video below and reading Chapter 28 on fiscal policy, discuss the pros and cons of the Keynesian versus classical economist approach to fiscal policy. Which approach do you favor? Why? Does your answer depend on the current state of the economy, such as whether or not the economy is in a deep recession or growing at a trend rate? https://www.youtube.com/watch?v=otmgFQHbaDo&list=PL8dPuuaLjXtPNZwz5_o_5uirJ8gQXnhEO&index=8
Part A: Instructions After reading Chapters 5, 7, & 8 in the textbook, spend a few...
Part A: Instructions After reading Chapters 5, 7, & 8 in the textbook, spend a few moments thinking about and reflecting upon the messages and lessons you have received from your family, friends, education, community, and society (Ecological Model of Health and Wellness) on food and nutrition. In the space below, answer the following questions. For each question, please reflect and respond with at least one thorough paragraph per question. a. Growing up, what are some messages you received from...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT