import java.util.*;
class Main {
public static void main(String[] args) {
Scanner scnr = new Scanner(System.in);
int[][] roaster = new int[5][2]; //five pairs of numbers including jersey number and player rank
boolean status = true;
char choice;
for (int i = 0; i < 5; i++) { //input roaster team // get jeresey number and rank
System.out.println("Enter player " + (i+1) + "'s jersey number: ");
roaster[i][0] = scnr.nextInt();
System.out.println("Enter player " + (i+1) + "'s rank: ");
roaster[i][1] = scnr.nextInt();
System.out.println();
}
System.out.println();
printTeam(roaster, 0);
while (status) { //infinite loop until presses q making status false
menu(); // menu
choice = scnr.next().charAt(0); // get choice
if (choice == 'q') { // if q then exit
status = false;
break;
} else if (choice == 'o') { // if o print roaster
printTeam(roaster, 0);
} else if (choice == 'u') { // u to update rank
System.out.println("Enter a jersey number: ");
int jerseyNum = scnr.nextInt();
System.out.println("Enter a new rank for the player: ");
int newrank = scnr.nextInt();
for (int l = 0; l < 5; l++) {
if (roaster[l][0] == jerseyNum) {
roaster[l][1] = newrank;
}
}
} else if (choice == 'a') { // get players above rank
System.out.println("Enter a rank: ");
int rank = scnr.nextInt();
printTeam(roaster, rank);
} else if (choice == 'r') { // r to replace
System.out.println("Enter a jersey number: ");
int jerseyNum = scnr.nextInt();
for (int l = 0; l < 5; l++) {
if (roaster[l][0] == jerseyNum) {
System.out.println("Enter a new jersey number: ");
roaster[l][0] = scnr.nextInt();
System.out.println("Enter a rank for the new player: ");
roaster[l][1] = scnr.nextInt();
}
}
}
}
}
public static void printTeam(int[][] roaster, int min) { //print team
System.out.println(((min>0) ? ("ABOVE " + min) : ("ROSTER")));
int item = 1;
for (int[] mem : roaster) {
if (mem[1] > min) {
System.out.println("Player " + item + " -- Jersey number: " + mem[0] + ", rank: " + mem[1]);
}
item++;
}
System.out.println();
}
public static void menu() {
System.out.println("MENU");
System.out.println("u - Update player rank");
System.out.println("a - Output roaster above a rank");
System.out.println("r - Replace player");
System.out.println("o - Output roster");
System.out.println("q - Quit\n");
System.out.println("Choose an option: ");
}
}
OUTPUT:
IF YOU HAVE ANY QUERY PLEASE COMMENT DOWN BELOW
PLEASE GIVE A THUMBS UP
Java 7.17 Clone of LAB*: Program: Soccer team roster This program will store roster and rating...
5.22 LAB*: Program: Soccer team roster steam This program will store roster and rating information for a soccer team Coaches rate players during tryouts to ensure (1) Prompt the user to input five pairs of numbers: A player's jersey number (0.99) and the player's rating (1-9) Store in one int array and the ratings in another int array Output these arrays (e. output the roster) (3 pts) numbers EX Enter player 1 jersey number: Enter player l's rating: Enter player...
5.19 Ch 5 Program: Soccer team roster (Vectors) (C++) This program will store roster and rating information for a soccer team. Coaches rate players during tryouts to ensure a balanced team. (1) Prompt the user to input five pairs of numbers: A player's jersey number (0 - 99) and the player's rating (1 - 9). Store the jersey numbers in one int vector and the ratings in another int vector. Output these vectors (i.e., output the roster). (3 pts) Ex:...
5.19 Lab 11b: Soccer team roster Instructor note: NOTE Unlike our other assignments, this one has only two programs: People's Weights and this one. To earn 30 points, you must do both assignments. Allow ample time to complete them Passing arrays to methods Review Chapter 6.8 Array Parameters if you wish to use methods in your program (a good idea). Since we pass a reference to the array's location in memory, changes made to the array within the method will...
In C Program This program will store the roster and rating information for a soccer team. There will be 3 pieces of information about each player: Name: string, 1-100 characters (nickname or first name only, NO SPACES) Jersey Number: integer, 1-99 (these must be unique) Rating: double, 0.0-100.0 You must create a struct called "playData" to hold all the information defined above for a single player. You must use an array of your structs to to store this information. You...
This program will store a roster of most popular videos with kittens. The roster can include at most 10 kittens.You will implement structures to handle kitten information. You will also use functions to manipulate the structure. (1) Create a structure kitten. The structure should contain the following attributes: name; string color; string score; integer Important! The name of the structure and each of its field must match exactly for the program to work and be graded correctly. (2) Create a...
(C++) Write a program that declares a struct to store the data of a football player (player’s name, player’s position, number of touchdowns, number of catches, number of passing yards, number of receiving yards, and the number of rushing yards). Declare an array of 10 components to store the data of 10 football players. Your program must contain a function to input data and a function to output data. Add functions to search the array to find the index of...
#PLEASE WRITE THE CODE IN JAVA! THANK YOU IN ADVANCE! Write a program that manages a list of up to 10 players and their high scores in the computer's memory. Use two arrays to manage the list. One array should store the players' names, and the other array should store the players' high scores. Use the index of the arrays to correlate the names with the scores. Your program should support the following features: a. Add a new player and...
Chapter 8 Python Case study Baseball Team Manager For this case study, you’ll use the programming skills that you learn in Murach’s Python Programming to develop a program that helps a person manage a baseball team. This program stores the data for each player on the team, and it also lets the manager set a starting lineup for each game. After you read chapter 2, you can develop a simple program that calculates the batting average for a player. Then,...
Case Study Baseball Team Manager. CMSC 135 Python Chapter 7 Assignment: Use a file to save the data Update the program so it reads the player data from a file when the program starts andwrites the player data to a file anytime the data is changed What needs to be updated: Specifications Use a CSV file to store the lineup. Store the functions for writing and reading the file of players in a separate module than the rest of the...
c++ A menu-driven program gives the user the option to find statistics about different baseball players. The program reads from a file and stores the data for ten baseball players, including player’s team, name of player, number of homeruns, batting average, and runs batted in. (You can make up your data, or get it online, for example: http://espn.go.com/mlb/statistics ) Write a program that declares a struct to store the data for a player. Declare an array of 10 components to...