Write a complete Java program including comments to do the following: Outline: The program will compute baseball statistics. The program will read in the id number and the won-lost record of a baseball team. It will compute various things about the team, and it will print everything out. Then it will repeat the process for a new team, over and over again, until the entire set of data has been taken care of. At the end, it will print the number of teams.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
100%

Please write a complete java program

Write a complete Java program including comments to do the following:
Outline:
The program will compute baseball statistics. The program will read in the id number and the won-lost record of a baseball team. It will compute
various things about the team, and it will print everything out. Then it will repeat the process for a new team, over and over again, until the entire set of
data has been taken care of. At the end, it will print the number of teams.
Here are the details:
1. The program will read in the id number of a team (see step 5 below). The program will read in the number of wins this team has and the number of
losses. For example, the program could read in the following three pieces of data--and it will print everything read in:
1234 5 7 [this says team 1234 has 5 wins, 7 losses]
2. The program will compute (and print) the total number of games played, which is simply the number of wins plus the number of losses. The
program will also print the number of games remaining in the season, which is 25 minus the total number of games played.
If the total number of games played is exactly 25, the program will print a message saying the season is finished. If the total is less than 25, the program
will print how many games are remaining in the season. You can assume that no team has played more than 25 games (see optional 3 below).
For example, for the team shown above, the total number of games played is 12, and there are 13 games remaining (25 - 12 = 13).
3. The program will compute the team's winning average, which is a decimal value between 0 and 1. The winning average is defined to be the number
of games won divided by the total number of games played. For the team shown above, the winning average is 5 / 12 = 0.4167. The program should
print this out as shown above, with exactly 4 decimal places.
4. The program will compare the number of games remaining to both the number of games won and the number of games lost, printing two separate
messages--one for each comparison. (Each question below must have a single message printed for it.)
First, the program will determine whether or not the number of games remaining is greater than or equal to the number won. Print an appropriate
message in either case.
Then the program will determine whether or not the number of games remaining is greater than the number lost; it will print an appropriate message in
either case.
Note that these two questions are not the same. And note carefully the phrasing of the two questions—if possible, use my phrasing. You must test all of
the four possible combinations of yes/no answers to these questions - see below.
5. Then the program should skip a few lines of output and repeat the entire series of steps for the next team, and so on, until the last team has been
processed. You must decide how to recognize that the last team has been processed.
6. At that point, print the total number of teams in the league, then stop.
Transcribed Image Text:Write a complete Java program including comments to do the following: Outline: The program will compute baseball statistics. The program will read in the id number and the won-lost record of a baseball team. It will compute various things about the team, and it will print everything out. Then it will repeat the process for a new team, over and over again, until the entire set of data has been taken care of. At the end, it will print the number of teams. Here are the details: 1. The program will read in the id number of a team (see step 5 below). The program will read in the number of wins this team has and the number of losses. For example, the program could read in the following three pieces of data--and it will print everything read in: 1234 5 7 [this says team 1234 has 5 wins, 7 losses] 2. The program will compute (and print) the total number of games played, which is simply the number of wins plus the number of losses. The program will also print the number of games remaining in the season, which is 25 minus the total number of games played. If the total number of games played is exactly 25, the program will print a message saying the season is finished. If the total is less than 25, the program will print how many games are remaining in the season. You can assume that no team has played more than 25 games (see optional 3 below). For example, for the team shown above, the total number of games played is 12, and there are 13 games remaining (25 - 12 = 13). 3. The program will compute the team's winning average, which is a decimal value between 0 and 1. The winning average is defined to be the number of games won divided by the total number of games played. For the team shown above, the winning average is 5 / 12 = 0.4167. The program should print this out as shown above, with exactly 4 decimal places. 4. The program will compare the number of games remaining to both the number of games won and the number of games lost, printing two separate messages--one for each comparison. (Each question below must have a single message printed for it.) First, the program will determine whether or not the number of games remaining is greater than or equal to the number won. Print an appropriate message in either case. Then the program will determine whether or not the number of games remaining is greater than the number lost; it will print an appropriate message in either case. Note that these two questions are not the same. And note carefully the phrasing of the two questions—if possible, use my phrasing. You must test all of the four possible combinations of yes/no answers to these questions - see below. 5. Then the program should skip a few lines of output and repeat the entire series of steps for the next team, and so on, until the last team has been processed. You must decide how to recognize that the last team has been processed. 6. At that point, print the total number of teams in the league, then stop.
DATA: Read in data for at least 8-10 teams. Make sure that at least three teams have completed their season, and at least five have not. Have at least
three teams with more wins than losses, at least two with an even record, and at least three with more losses than wins. Have a team with the number of
wins equal to the number remaining, and have a team with the number of losses equal to the number remaining. Have a team with all wins, and have a
team with all losses. (You may read data interactively or from a file. If you use an external file, print and hand in a copy of the data.)
Make sure that every possible path is covered by a set of data.
Here is a complete set of output for a typical team:
team 9867
4 wins 12 losses
total number of games played is 16
the winning average is 0.2500
9 games remaining
number of games remaining is greater than or equal to number won
number of games remaining is not greater than number lost
OPTIONALS: 1. For each team that has not completed the season, compute the team's record if it wins all of the remaining games (give the won-lost
record and the winning average), and the record if it loses all of the remaining games.
2. Keep track of the team with the best winning average that is not exactly 1. Print this out at the end. Do the same just for those teams that have
completed their season.
3. If a team has completed more than 25 games, print an error message, ask the user to type in new data (repeat if necessary). Do NOT process the
original set of data.
Transcribed Image Text:DATA: Read in data for at least 8-10 teams. Make sure that at least three teams have completed their season, and at least five have not. Have at least three teams with more wins than losses, at least two with an even record, and at least three with more losses than wins. Have a team with the number of wins equal to the number remaining, and have a team with the number of losses equal to the number remaining. Have a team with all wins, and have a team with all losses. (You may read data interactively or from a file. If you use an external file, print and hand in a copy of the data.) Make sure that every possible path is covered by a set of data. Here is a complete set of output for a typical team: team 9867 4 wins 12 losses total number of games played is 16 the winning average is 0.2500 9 games remaining number of games remaining is greater than or equal to number won number of games remaining is not greater than number lost OPTIONALS: 1. For each team that has not completed the season, compute the team's record if it wins all of the remaining games (give the won-lost record and the winning average), and the record if it loses all of the remaining games. 2. Keep track of the team with the best winning average that is not exactly 1. Print this out at the end. Do the same just for those teams that have completed their season. 3. If a team has completed more than 25 games, print an error message, ask the user to type in new data (repeat if necessary). Do NOT process the original set of data.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Knowledge Booster
Random Class and its operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education