Answered step by step
Verified Expert Solution
Question
1 Approved Answer
import java.util.Scanner; public class PeopleWeights { public static void main(String[] args) { Standards that you MUST adhere to for this assignment: Use Eclipse to write
import java.util.Scanner;
public class PeopleWeights { public static void main(String[] args) {
Standards that you MUST adhere to for this assignment:
- Use Eclipse to write a code.
- In your code:
- Create the class called Baseball_YourName
- Code should be written well with the appropriate programming techniques.
- Use the standards taught to you for source code indentation and formatting as well as consistency in names.
- Use the /* ** */ format of comments to put add the heading of your program. It should include Author:, Date:, Course and Section Number:, Program Name:, Program Purpose
- Your heading should include an algorithm.
- Use the // format of comments to put comments within the code.
Challenge Problem Solving Loops and Arrays Problem Description/Purpose: Write a program that will compute and display the final score of two teams in a baseball game. The number of innings in a baseball game is 9. Your program should read the name of the teams. While the user does not enter the word done for the first team name, your program should read the second team name and then read the number of runs for each Inning for each team, calculate the total scores and display the total score for each team. o Create a constant for 9 innings. o Create an array of String to hold the baseball team names (Array size is 2) o Create an array to store each team's total scores. (Array size is 2) o You know there are exactly 2 teams. You also know there are exactly 9 innings. Use loops such that: o for team, I for inning, the user enters the number of runs scored and adds to the total for each team. o Display the final scores afterwards. o Repeat with new teams until the user enters the word "done" instead of a name for the first team name. o End the program with the words "Program complete" Hints: o STUDY THE OUTPUT EXAMPLES at the end of this document very carefully. This project will need multiple for loops and a while loop. . You may need to use a blanket statement of keyboard.nextLine() if you are reading a sequence of integers and then a nextLine. Requirements/Task(s): The appropriate set of variables and data types for those variables should be created. Feel free to create AS MANY variables as you need. You must use a constant for the number of Innings. You must use for loop(s) and a while loop where appropriate.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Heres a modified version of your code with the requested changes java import javautilScanner Author ...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started