Question

In Java I have 3 .txt files: Super Bowl Year.txt, Super Bowl Winning Team.txt and Super Bowl Losing Team.txt. they contain the year of the Super Bowls from 1967 through 2023, the winning teams for each year , and the losing teams for each year all are in order from 2023 to 1967. How would I write a program that reads the data from these files into three arrays. The program should then set up a menu to do the following: 1. Display the winning team and losing team for a specific year 2. Display the years and number of times a specific team has won the Super Bowl 3. Display the years and number of times a specific team as lost the Super Bowl 4. Display the number of times a specific team has been in the Super Bowl 5. Quit The program must include the following: Methods to accomplish the tasks in the menu Validation for the user input for the year – It must be greater than or equal to 1967 and less than or equal to 2023 Comments describing each method as well as any special coding

          In Java I have 3 .txt files: Super Bowl Year.txt, Super Bowl Winning Team.txt and Super Bowl Losing Team.txt. they contain the year of the Super Bowls from 1967 through 2023, the winning teams for each year , and the losing teams for each year all are in order from 2023 to 1967. 
How would I write a program that reads the data from these files into three arrays. The program should then set up
a menu to do the following:
1. Display the winning team and losing team for a specific year
2. Display the years and number of times a specific team has won the Super Bowl
3. Display the years and number of times a specific team as lost the Super Bowl
4. Display the number of times a specific team has been in the Super Bowl
5. Quit
The program must include the following:
Methods to accomplish the tasks in the menu
Validation for the user input for the year – It must be greater than or equal to 1967 and less
than or equal to 2023
Comments describing each method as well as any special coding
        
Show more…

Added by Lisa K.

Computer Science and Information Technology
Computer Science and Information Technology
Trishna Knowledge Systems 2018 Edition
AceChat toggle button
Close icon
Ace pointing down

Please give Ace some feedback

Your feedback will help us improve your experience

Thumb up icon Thumb down icon
Thanks for your feedback!
Profile picture
In Java I have 3 .txt files: Super Bowl Year.txt, Super Bowl Winning Team.txt and Super Bowl Losing Team.txt. they contain the year of the Super Bowls from 1967 through 2023, the winning teams for each year , and the losing teams for each year all are in order from 2023 to 1967. How would I write a program that reads the data from these files into three arrays. The program should then set up a menu to do the following: 1. Display the winning team and losing team for a specific year 2. Display the years and number of times a specific team has won the Super Bowl 3. Display the years and number of times a specific team as lost the Super Bowl 4. Display the number of times a specific team has been in the Super Bowl 5. Quit The program must include the following: Methods to accomplish the tasks in the menu Validation for the user input for the year – It must be greater than or equal to 1967 and less than or equal to 2023 Comments describing each method as well as any special coding
Close icon
Play audio
Feedback
Powered by NumerAI
David Collins Ivan Kochetkov
Kathleen Carty verified

Supreeta N and 92 other subject AP CS educators are ready to help you.

Ask a new question

*

Labs

-

Want to see this concept in action?

NEW

Explore this concept interactively to see how it behaves as you change inputs.

View Labs

*

Key Concepts

-
Key Concept
Premium Feature
Explore the core concept behind this problem.
Play button
Key Concept
Premium Feature
Explore the core concept behind this problem.
Your browser does not support the video tag.

*

Recommended Videos

-
create-a-program-called-tenniswinpercentagearrayjava-an-input-file-called-tennisinputtxt-contains-the-following-data-name-of-a-tennis-player-the-year-the-player-turned-pro-the-number-of-year-29778

Create a program called TennisWinPercentageArray.java. An input file called tennisInput.txt contains the following data: • Name of a tennis player • The year the player turned pro • The number of years the player has played competitive tennis • The number of wins and losses for each year starting from the player’s first year (if the player has been pro for three years, there will be six int values: wins, losses, wins, losses, wins, losses) In the main method: • Read the name of a tennis player • Read the year the player turned pro • Read the number of years the tennis player has played competitive tennis. Use this value as the size of an array of type double. • Create a for loop that iterates from 0 to the number of years the player has played pro. In the loop, read the number of wins and losses for the year. Calculate win percentage (wins / (wins + losses)) and store this value in the array. The element at index 0 will store the win percentage for the player’s first year. • Call the method printWinPercentage() with the player’s name, the first year of play, and the array In the printWinPercentage() method: • There should be three parameters: a String for the player’s name, int for the first year of play, and a double array • Display the player’s name • Display the year and the win percentage (multiplied by 100, output to 1 decimal) for each year.

Supreeta N.

import-javautilscanner-word-manager-52pp-collection-of-strings-author-your-name-here-public-class-wordmanager-adds-the-word-to-the-next-empty-space-in-the-array-if-there-is-space-returns-the-24779

import java.util.Scanner; /** * Word Manager (5.2PP Collection of Strings) * * @author Your Name Here */ public class WordManager { /** * Adds the word to the next empty space in the array, if there is space. * Returns the new size of the array. */ public static int add(String[] words, int count, String word) { //TO DO: Complete the implementation of this method return count; } /** Displays the words in the collection as a comma separated list. */ public static void printList(String[] words, int count) { //TO DO: Complete the implementation of this method } //TO DO: Add an implementation of averageLength public static void main(String[] args ) { Scanner sc = new Scanner(System.in); //TO DO: Add necessary variable (and constant) declarations and initialisations //TO DO: Implement the menu } } Program: WordManager Constants: int CAPACITY, maximum number of words, initialized to 20 Variables: Scanner sc, to read user input, initialized when declared String[] words, collection of words, initialized to hold CAPACITY elements int count, number of elements in words, initialized to 0 int choice, user's menu selection String aWord, new word given by user Steps: 1. Display "Word Manager" 2. Do 3. Display a menu "1. Add a word 2. Display words 3. Display average word length 4. Quit" 4. Prompt user to "Enter option: " 5. Assign choice value of next int from sc (the Scanner) 6. Switch based on choice 7. In the case that choice is 1: - Prompt for and read in next word from user, storing in aWord - Assign count result of calling add with words, count, aWord 8. In the case that choice is 2: - Call printList with words, count 9. In the case that choice is 3: - Display "Average word length: " + result of calling averageLength with words, count 10. While choice is not 4 Method: double averageLength(String[] words, int count) Returns: double, the average length of the first count words in the array words Parameters: String[] words, the list of words int count, the number of filled positions in the array Variables: For you to decide Steps: 1. Calculate the sum of each word's length 2. Calculate and return the average word length (that sum divided by count)

Supreeta N.

can-someone-help-me-with-this-java-program-example-of-the-output-enter-the-home-team-enter-team-member-1-name-aaron-height-73-enter-team-member-2-name-abe-height-78-enter-team-member-3-name-02275

Can someone help me with this Java program? Example of the output: Enter the home team Enter team member 1: Name: Aaron Height: 73 Enter team member 2: Name: Abe Height: 78 Enter team member 3: Name: Andrew Height: 80 Enter the visiting team Enter team member 1: Name: Bob Height: 70 Enter team member 2: Name: Ben Height: 81 Enter team member 3: Name: Bill Height: 78 The home team is taller. Taller team roster: Team{numPlayers=3, members=[Player{name='Aaron', height=73}, Player{name='Abe', height=78}, Player{name='Andrew', height=80}]} Shorter team roster: Team{numPlayers=3, members=[Player{name='Bob', height=70}, Player{name='Ben', height=81}, Player{name='Bill', height=78}]} Write a program that keeps track of the players in a 3x3 basketball game. Your program should have the following classes: 1. A Player class. A Player has instance variables for name and height. Keep height in inches, use an int. Implement overloaded constructors: - A constructor that takes name and height parameters - A no-argument constructor Implement getters and setters for name and height. Implement a toString() method that returns a player's data as a String object. 2. A Team class. A Team has: - An instance variable that is an array of the team's players (i.e., Player[] myTeam) - An instance variable that indicates the next open position of the team array. You may assume that no more than 3 players will be added to a team, but a team might have less than 3 players. - A method void add(Player player) that adds a player to the team. - A method Player[] getCurrentTeamMembers() that returns a player array of all the players currently on the team (note that the team may not have a full roster when this method is called). - A method int averageHeight() that returns the average height (in inches) of all the players currently on the team. Your code should handle a team with no members. 3. A Game class. A Game class has: - A private static Scanner class variable for reading user input from the keyboard. - A method private static void fillRoster() that uses the Scanner to query the user for all of the players on a Team. - A main method. The main method has two Team variables, home and visitor. It: - Prompts the user to enter data for the home team, and then calls fillRoster() to create the Team object. - Prompts the user to enter data for the visiting team, and then calls fillRoster() to create the Team object. - Prints the taller team's roster. - Prints the shorter team's roster.

Akash M.


*

Recommended Textbooks

-
Computer Science and Information Technology

Computer Science and Information Technology

Trishna Knowledge Systems 2018 Edition
achievement 1,573 solutions
Introduction to Programming Using Python

Introduction to Programming Using Python

Y. Daniel Liang 1st Edition
achievement 1,274 solutions
Computer Science - An Overview

Computer Science - An Overview

Glenn Brookshear, Dennis Brylow 12th Edition
achievement 1,839 solutions

*

Transcript

-
00:01 Hello students, to read the data from the tennisinput .txt file and calculate the win percentage area for each year of the tennis player, so you use the implementation as the tenniswinpercentagearray .java program.
00:20 So here you need to ensure that the tennisinput .txt file is in the same directory as the program provided the correct path in the file as the file reader constructor.
00:33 As the program reads the player's information from the file including their name, their year, their turn, pros and the number of years they played competitive tennis.
00:46 It then creates the array to store the win percentage for each year.
00:52 After reading the data, it calculates the win percentage and stores it in an array.
01:00 Finally, the program calls the printwinpercentage() method to display the player's name and win the percentage of each year.
01:12 As you can see, i'll just summarize the code over here.
01:17 It opens the tennisinput .txt file using the buffer reader to read the player's information and the performance data...
Need help? Use Ace
Ace is your personal tutor. It breaks down any question with clear steps so you can learn.
Start Using Ace
Ace is your personal tutor for learning
Step-by-step explanations
Instant summaries
Summarize YouTube videos
Understand textbook images or PDFs
Study tools like quizzes and flashcards
Listen to your notes as a podcast
Continue solving this problem
Create a free account to:
  • View full step-by-step solution
  • Ask follow-up questions with Ace AI
  • Save progress and study later
Continue Free
Numerade

Get step-by-step video solution
from top educators

Continue with Clever
or



By creating an account, you agree to the Terms of Service and Privacy Policy
Already have an account? Log In

A free answer
just for you

Watch the video solution with this free unlock.

Numerade

Log in to watch this video
...and 100,000,000 more!


EMAIL

PASSWORD

OR
Continue with Clever