import java.util.Scanner;
class Main {
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
int[] jersey = new int[5];
int[] rating = new int[5];
int count = 0;
char choice = 'o';
// taking input of 5 members
for(count = 0; count<5; count++)
{
System.out.printf("Enter player %d's jersey number:\n", count+1);
jersey[count] = keyboard.nextInt();
System.out.printf("Enter player %d's rating:\n", count+1);
rating[count] = keyboard.nextInt();
}
while(true)
{
if(choice == 'u')
{
System.out.print("\nEnter a jersey number: ");
int jnum = keyboard.nextInt();
// finding the index of that jersey
int ind = 0;
for(ind = 0; ind < count && jersey[ind] != jnum; ind++);
// taking rating
if(jersey[ind] == jnum)
{
System.out.print("Enter a new rating: ");
rating[ind] = keyboard.nextInt();
}
}
else if(choice == 'a')
{
// taking input of rating
System.out.print("\nEnter a rating: ");
int above = keyboard.nextInt();
int track = 1;
System.out.println("\nABOVE " + above);
// printing only if the rating is above that
for(int i=0; i<count; i++)
{
if(rating[i] > above)
System.out.printf("Player %d -- Jersey number: %d, Rating: %d\n",track++,jersey[i],rating[i]);
}
}
else if(choice == 'r')
{
// taking jersey number
System.out.print("\nEnter a jersey number: ");
int jnum = keyboard.nextInt();
int ind = 0;
// finding the index
for(ind = 0; ind < count && jersey[ind] != jnum; ind++);
if(jersey[ind] == jnum)
{
// taking input of other rating and number and updating
System.out.print("Enter a new jersey number: ");
jersey[ind] = keyboard.nextInt();
System.out.print("Enter a rating for the new player: ");
rating[ind] = keyboard.nextInt();
}
}
else if(choice == 'o')
{
// printing the roster
System.out.println("\nROSTER");
for(int i=0; i<count; i++)
{
System.out.printf("Player %d -- Jersey number: %d, Rating: %d\n",i+1,jersey[i],rating[i]);
}
}
System.out.println("\nMENU\nu - Update player rating\na - Output players above a rating\nr - Replace player\no - Output roster\nq - Quit");
choice = keyboard.next().charAt(0);
if(choice == 'q')
break;
}
}
}
/* OUTPUT
ROSTER
Player 1 -- Jersey number: 3, Rating: 4
Player 2 -- Jersey number: 5, Rating: 2
Player 3 -- Jersey number: 8, Rating: 4
Player 4 -- Jersey number: 9, Rating: 4
Player 5 -- Jersey number: 7, Rating: 9
MENU
u - Update player rating
a - Output players above a rating
r - Replace player
o - Output roster
q - Quit
u
Enter a jersey number: 3
Enter a new rating: 6
MENU
u - Update player rating
a - Output players above a rating
r - Replace player
o - Output roster
q - Quit
o
ROSTER
Player 1 -- Jersey number: 3, Rating: 6
Player 2 -- Jersey number: 5, Rating: 2
Player 3 -- Jersey number: 8, Rating: 4
Player 4 -- Jersey number: 9, Rating: 4
Player 5 -- Jersey number: 7, Rating: 9
MENU
u - Update player rating
a - Output players above a rating
r - Replace player
o - Output roster
q - Quit
a
Enter a rating: 4
ABOVE
Player 1 -- Jersey number: 3, Rating: 6
Player 2 -- Jersey number: 7, Rating: 9
MENU
u - Update player rating
a - Output players above a rating
r - Replace player
o - Output roster
q - Quit
r
Enter a jersey number: 7
Enter a new jersey number: 6
Enter a rating for the new player: 1
MENU
u - Update player rating
a - Output players above a rating
r - Replace player
o - Output roster
q - Quit
o
ROSTER
Player 1 -- Jersey number: 3, Rating: 6
Player 2 -- Jersey number: 5, Rating: 2
Player 3 -- Jersey number: 8, Rating: 4
Player 4 -- Jersey number: 9, Rating: 4
Player 5 -- Jersey number: 6, Rating: 1
MENU
u - Update player rating
a - Output players above a rating
r - Replace player
o - Output roster
q - Quit
q
*/
5.19 Lab 11b: Soccer team roster Instructor note: NOTE Unlike our other assignments, this one has...
Java 7.17 Clone of LAB*: Program: Soccer team roster 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, but this is NOT enforced by the program nor tested) and the player's rating (1-9, not enforced like jersey numbers). Store the jersey numbers in one int array and the ratings in another int...
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.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...
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...
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,...
(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...
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...
In this project, you will use functions and dictionaries to track basketball players and their respective points, then display statistics of points made. You will need three functions as follows: def freeThrowMade(playerDictionary, playerName) - this function will add 1 point to the player's total score def twoPointMade(playerDictionary, playerName) - this function will add 2 points to the player's total score def threePointMade(playerDictionary, playerName) - this function will add 3 points to the player's total score Each of these functions has...
C++ Language Overview: Design an APP for a basketball team with a unique name. There should be at least 10 players. The member variables required include team member’s names, jersey number, position played, and at least 3 stats. Positions are small forward, power forward, center, shooting guard and point guard. 1. A.) Design a class with member variables and appropriate member functions Data should be stored in a read/write file consisting of team member’s names, jersey number, position played, and...