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...
-
For the initial probability vector [0.1 0.9] and the transition matrix A, find the next two probability vectors. 0.4 A = 0.8 0.6 0.2
-
John Fleming, chief administrator for Valley View Hospital, is concerned about the costs for tests in the hospitals lab. Charges for lab tests are consistently higher at Valley View than at other...
-
What is meant by configuration effectivity?
-
McBurger, Inc., wants to redesign its kitchens to improve productivity and quality. Three designs, called designs K1, K2, and K3, are under consideration. No matter which design is used, daily demand...
-
Additional comments: Use the financial information found in the balance sheet and income statement to calculate the financial ratios for the year 2019. Include your results in the column with the...
-
Case : Karl and June Monroe
-
A regular hexagon of side 10 cm has a charge 5 C at each of its vertices. Calculate the potential at the centre of the hexagon.
-
Alco, Inc., has a progressive board of directors and CEO who are committed to creating and maintaining an ethical culture within its business environment. It has an extensive corporate compliance and...
-
A retail company must file a monthly sales tax report listing the total sales for the month, and the amount of state and county sales tax collected. The state sales tax rate is 4 percent and the...
-
LiveJournal was a popular social media platform which enabled online communities to post comments and content related to particular themes. Its most popular community was called Oh No They Didnt!...
-
In a lawsuit against Angies List, Inc. for overtime pay, sales representatives were paid based on a 40-hour workweek but alleged that they routinely worked 50 to 60 hours a week without extra...
-
Yazaki Corporation and DENSO Corporation are both Japanese companies that supply electrical components to manufacturers of automobiles. Following an investigation by the U.S. Department of Justice in...
-
Find the equivalent resistance for the circuit shown in Figure 7.20. R=1 R= 2.2 Figure 7.20 R3 = 30 R = 60 R =18 R6 = 40
-
Big Jim Company sponsored a picnic for employees and purchased a propane grill equipped with a standard-sized propane tank for the picnic. To make sure there was enough propane for all the cooking...
-
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...
-
A reversible heat engine operates between two reservoirs at temperatures, \(700^{\circ} \mathrm{C}\) and \(50^{\circ} \mathrm{C}\). The engine drives a reversible refrigerator which operates between...
-
Two Carnot engines work in series between the source and sink temperatures of \(500 \mathrm{~K}\) and \(300 \mathrm{~K}\). If both engines develop equal power determine the intermediate temperature.
-
A reversible heat engine working between two thermal reservoirs at \(875 \mathrm{~K}\) and \(315 \mathrm{~K}\) drives a reversible refrigerator which operates between the same \(315 \mathrm{~K}\)...
Study smarter with the SolutionInn App