Write a program that implements a class called MyTeam. Your class should have the following private...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write a program that implements a class called MyTeam. Your class should have the following private data items: Id (int), Name (string), Slogan (string), Wins (int) and Losses (int). You need to define properties with appropriate accessor functions for each of the data items. Methods should include a default constructor that sets values to the empty string or zero, a constructor that allows the user to specify all values for the data items, a member method called DisplayTeamInfo that outputs all the information for the given toy in a reasonable format. Challenge Problem: Code your set accessors to restrict all numeric fields (Id, Wins, Losses) to positive numbers. You can determine how you want to report/respond to the error. (25 pts) The code below is my suggestion for your Main() method static void Main(string[] args) { } MyTeam myHitchhikers = new MyTeam(); myHitchhikers. Id = 42; myHitchhikers. Name = "Ford Prefect et. al."; myHitchhikers. Slogan = "Don't panic!"; myHitchhikers. Wins = 525; myHitchhikers. Losses = 42; Console.WriteLine("\nTeam 1 Information"); myHitchhikers. Display TeamInfo(); MyTeam mykitties = new My Team(); Console.WriteLine("\nTeam 2 Information"); myKitties.Display Team Info(); MyTeam myPatriots = new MyTeam (2023, "UC Patriots", "One Big Team", 42, 3); Console.WriteLine("\nTeam 3 Information"); myPatriots. Display Team Info(); //This will test your Challenge Problem Settings if you attempted them Console.WriteLine("\nTeam 4 Information"); MyTeam myWinners = new MyTeam (-13, "Winners", "We like to win more than you do", -20, -35); myWinners. Display Team Info(); Write a program that implements a class called MyTeam. Your class should have the following private data items: Id (int), Name (string), Slogan (string), Wins (int) and Losses (int). You need to define properties with appropriate accessor functions for each of the data items. Methods should include a default constructor that sets values to the empty string or zero, a constructor that allows the user to specify all values for the data items, a member method called DisplayTeamInfo that outputs all the information for the given toy in a reasonable format. Challenge Problem: Code your set accessors to restrict all numeric fields (Id, Wins, Losses) to positive numbers. You can determine how you want to report/respond to the error. (25 pts) The code below is my suggestion for your Main() method static void Main(string[] args) { } MyTeam myHitchhikers = new MyTeam(); myHitchhikers. Id = 42; myHitchhikers. Name = "Ford Prefect et. al."; myHitchhikers. Slogan = "Don't panic!"; myHitchhikers. Wins = 525; myHitchhikers. Losses = 42; Console.WriteLine("\nTeam 1 Information"); myHitchhikers. Display TeamInfo(); MyTeam mykitties = new My Team(); Console.WriteLine("\nTeam 2 Information"); myKitties.Display Team Info(); MyTeam myPatriots = new MyTeam (2023, "UC Patriots", "One Big Team", 42, 3); Console.WriteLine("\nTeam 3 Information"); myPatriots. Display Team Info(); //This will test your Challenge Problem Settings if you attempted them Console.WriteLine("\nTeam 4 Information"); MyTeam myWinners = new MyTeam (-13, "Winners", "We like to win more than you do", -20, -35); myWinners. Display Team Info();
Expert Answer:
Answer rating: 100% (QA)
Heres a C program that implements the MyTeam class with the specified private data items properties ... View the full answer
Related Book For
Java An Introduction To Problem Solving And Programming
ISBN: 9780134462035
8th Edition
Authors: Walter Savitch
Posted Date:
Students also viewed these programming questions
-
Determine the Prior Year and Current Year trend percents for net sales using the Prior Year as the base year. Note: Enter the answers in thousands of dollars. Current Year: Prior Year: Trend Percent...
-
This assignment reviews object-oriented programming concepts such as classes, methods, constructors, accessor methods, and access modifiers. It makes use of an array of objects as a class data...
-
In this assignment, you will create a program that allows theuser to draw in a window using brushes of different sizes andcolors. The user will be able to change the size and color of thebrush using...
-
A stock is trading at $70. You believe there is a 70% chance the price of the stock will increase by 10% over the next 3 months. You believe there is a 10% chance the stock will drop by 10%, and you...
-
Assume that it takes four hours of labor time to paint a room and two hours to sand a floor. If all 24 hours were spent painting, (a) How many rooms could be painted by one worker? (b) If a decision...
-
Bavarian Motor Company (BMC) manufacturers cars and SUVs in Europe and ships them to distributors in the U.S. Presently, BMC has an inventory of 200 cars and 140 SUVs in Newark, NJ and 300 cars and...
-
Thomas Baker, president of Brundage Corporation, says he has observed that an increase in sales almost always results in an increase in net income. Therefore, he is considering recommending that the...
-
Martin, Mark, and Marvin formed a retail clothing partnership named M Clothiers and conducted a business for many years, buying most of their clothing from Hill, a wholesaler. On January 15, Marvin...
-
162,500 150,000 137,500 125,000 112,500 105,042 100,000 87,500 75,000 62,500 50,000 37,500 25,000 12,500 125,000 162,500 55,578 67,250 137,712 ll Company 3 0 Company 1 Company 2 Online Sales Last...
-
On January 1, 2021, Gundy Enterprises purchases an office for $360,000, paying $60,000 down and borrowing the remaining $300,000, signing a 7%, 10-year mortgage. Installment payments of $3,483.25 are...
-
Answer the below 11 questions with no less than 3 pages of content. 1. List five aspects of corporate or organizational culture. 2. What are five ways that an organization may attempt to instill a...
-
Assume a $40,000 investment and the following cash flows for two alternatives. Year Investment A Investment B $ 10,000 $ 10,000 12345 10,000 15,000 10,000 20,000 20,000 25,000 a. Calculate the...
-
Abby is a 20-year-old female college student. For at least the last 3 months, Abby has experienced ongoing anxiety and worry without a specific cause for these feelings. She has been restless and has...
-
Two random binary signals, A and B, combine to form an output C where C=AB. In other words, C = 1 only when {A = 1 and B = 0}, or {A = 0 and B = 1}. Signal A is equal to 1 with probability p; signal...
-
c. The following values are saved on a binary search tree (ordered) as seen below. Identify and make a note of the missing values on the tree. 3,7,9, 15, 18, 28, 31, 35, 37 O 15 9 28 31 (37
-
Blossom Tire Co . just paid an annual dividend of $ 1 . 2 0 on its common shares. If Blossom is expected to increase its annual dividend by 4 . 1 percent per year into the foreseeable future and the...
-
A stated a practice research topic (A practice research topic could be examining how social media affects political participation) for which the exploration of archival secondary data sources from...
-
Gopher, Inc. developing its upcoming budgeted Costs of Quality (COQ) with the following information: Expense Item Budget Raw Materials Inspection $ 15,000 EPA Fine 200,000 Design Engineering 15,000...
-
How does a computers main memory differ from its auxiliary memory?
-
Write a program that reads a bank account balance and an interest rate and displays the value of the account in ten years. The output should show the value of the account for three different methods...
-
Revise the class TimeBook in Listing 7.14 to use an enumeration for the days of the week instead of named constants. Listing 7.14 Class that records the t ime worked by each of a company's employees...
-
Suppose that we have the data \(\tau_{\mathrm{n}}=\left\{x_{1}, \ldots, x_{n} ight\}\) in \(\mathbb{R}\) and decide to train the two-component Gaussian mixture model \[ g(x \mid...
-
A generalization of both the gamma and inverse-gamma distribution is the generalized inverse-gamma distribution, which has density \[ \begin{equation*} f(s)=\frac{(a / b)^{p / 2}}{2 K_{p}(\sqrt{a...
-
A \(d\)-dimensional normal random vector \(X \sim \mathscr{N}\left(\boldsymbol{\mu}, \sum ight)\) can be defined via an affine transformation, \(\boldsymbol{X}=\boldsymbol{\mu}+\boldsymbol{\Sigma}^{1...
Study smarter with the SolutionInn App