Create a struct for a baseball player. Include the player's
Name (string), Batting Average (percentage), Home Runs (int),
RBI's (int), Runs Scored (int), Stolen bases (int),
current salary (float) and current team (string).
Create three players using your struct and then display the stats from each player to the screen using the members of the struct- three extra credit points for doing this for all members of the struct in a function.
#define _CRT_SECURE_NO_WARNINGS #include<stdio.h> #include<string.h> struct player { char name[50]; float bat_avg; int home_run; int rbi; int run_scored; int stolen_base; float current_salary; char current_team[50]; }; void display(struct player x) { printf("Name : %s\n", x.name); printf("Batting average : %f\n", x.bat_avg); printf("Home runs : %d\n", x.home_run); printf("RBI's : %d\n", x.rbi); printf("Runs Scored : %d\n", x.run_scored); printf("Stolen bases : %d\n", x.stolen_base); printf("Current Salary: %f\n", x.current_salary); printf("Current team: %s\n", x.current_team); } int main() { struct player p1, p2, p3; strcpy(p1.name , "Andy Robbin"); p1.bat_avg = 30.65; p1.home_run = 2000; p1.rbi = 10; p1.run_scored = 3000; p1.stolen_base = 23; p1.current_salary = 10000.20; strcpy(p1.current_team, "Team 1"); strcpy(p2.name, "Steve"); p2.bat_avg = 20.99; p2.home_run = 1574; p2.rbi = 7; p2.run_scored = 3500; p2.stolen_base = 50; p2.current_salary = 5000.56; strcpy(p2.current_team, "Team 2"); strcpy(p3.name, "Brian Daniels"); p3.bat_avg = 42.32; p3.home_run = 5000; p3.rbi = 12; p3.run_scored = 5000; p3.stolen_base = 17; p3.current_salary = 7000; strcpy(p3.current_team, "Team 3"); display(p1); display(p2); display(p3); getch(); return 0; }
Create a struct for a baseball player. Include the player's Name (string), Batting Average (percentage), Home...
Write a class called Player that has four data members: a string for the player's name, and an int for each of these stats: points, rebounds and assists. The class should have a default constructor that initializes the name to the empty string ("") and initializes each of the stats to -1. It should also have a constructor that takes four parameters and uses them to initialize the data members. It should have get methods for each data member. It...
Using C# Create a database that stores baseball player information. You will have the following columns. You will need to have the ability to add rows and display the records. You may use LINQ or Given example using an access accdb file... Name string Batting Average floating, decimal, double team string jersey number int ID autonumber
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++ 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...
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...
Read through the code of the class Player, noting it has two instance variables, name and rank, which are of type String and three further instance variables won, drew and lost which are of type int. There is also an attribute of the class, points, which does not have a corresponding instance variable. Also note the constructor and methods of the class and what they do. TournamentAdmin class code: public class RankAdmin { /** * Constructor for objects of class...
I need to update this C++ code according to these instructions. The team name should be "Scooterbacks". I appreciate any help! Here is my code: #include <iostream> #include <string> #include <fstream> using namespace std; void menu(); int loadFile(string file,string names[],int jNo[],string pos[],int scores[]); string lowestScorer(string names[],int scores[],int size); string highestScorer(string names[],int scores[],int size); void searchByName(string names[],int jNo[],string pos[],int scores[],int size); int totalPoints(int scores[],int size); void sortByName(string names[],int jNo[],string pos[],int scores[],int size); void displayToScreen(string names[],int jNo[],string pos[],int scores[],int size); void writeToFile(string...
The following is a chart of 25 baseball players' salaries and statistics from 2016 Player Name Salary (in millions) RBI's HR'S AVG Mike Trout 0.315 100 29 16.083 0.261 Joe Mauer 49 11 23.000 Victor Martinez 86 27 0.289 18.000 Albert Pujols 119 31 0.268 25.000 Hanley Ramirez 111 30 0.286 22.750 Jayson Werth 21.571 70 21 0.244 Buster Posey 0.288 80 14 20.802 Rajai Davis Adam Jones 48 12 0.249 5.950 0.265 83 29 16.000 Joey Votto 97 29...
In C++: Functions to include: editPlayer: is a void fn, which takes an array of playerType and calls lookUpPlayer which returns the index of the target (-1 if not found). If found allows the user to edit any of the data members of the player via a menu system. lookUpPlayer: is a int fn, which takes an array of playerTypes, prompts the user for the name of the player and attempts to find them. If found, prints message "found" and...
Language: JAVAPart a: Write a class called Geniegotchi with:1. Private data fields: name (of String type, initialized to “Bob”), endurance (of int type, initialized to 4) and happiness (of int type, initialized to 3);2. Public methods:-void setName(String newName) : renames Genie with newName, printsnewName confirmation to screen;void setName(String newName) : renames Genie with newName, printsnewName confirmation to screen;- intgetEndurance() : returns current endurance;-intgetHappiness() : returns current happiness;-void feed() : this method increases current endurance by 1 if endurance is less...