We want to create a stock class and associate all these data and methods with it, and then test it out a little bit. Display the symbol and name of the company, the previous and current prices and price-change percentage. Display the symbol and name of the company, the previous and current prices and price-change percentage.Īdd code to create another Stock object with the stock symbol ORCL, the name Oracle Corporation/ PreviousClosingPrice is a private double data area that stores the stock price for the previous day.ĬurrentPrice is a private double data area that stores the stock price at the current time.Ī constructor for creating a stock with the given symbol and name.įor the data fields, there are accessor methods (get-methods).įor the data fields, there is a mutator method (set-methods).Ī method named getChangePercent()that returns the percentage changed from previousClosingPrice to currentPrice.įormula:perc_change = (current price - previous closing price) / previous closing price x 100Ĭreate a test class named testStockthat creates a Stockobject with the stock symbol SUNW, the name Sun Microsystems Inc., and the previous closing price of 100. The stock's name is stored in a private string data field called name. The symbol of the stock is stored in a private string data field called symbol. Specifications:Ĭreate a Stock object class that contains the following information: UPDATE: There is on error in the UML ond the two constructors in the SportsTeam abstract closs should be nomed Sports Team rather than Team. fieldGoals:int -fieldGoalsAttempted: int -freeThrows: int -freeThrowsAttempted: int +BasketballTeam) +BasketballTeam(String teamName, String teamMascot, String headCoach) +fieldGoalPercentage(): double +freeThrowPercentage0: double +setStats(int wins, int losses, int fieldGoals, int FieldGoalsAttempted, int freeThrows, int freeThrowsAttempted): void #teamName: String #teamMascot: String #headCoach: String #wins: int #losses: int +Team() +Team(String teamName, String teamMascot, String headCoach) +getWinPercentage:double +getStats(): double > Your classes should adhere to the UML Diagram below and the following specs: Program 2 For this lab, you will write two classes, SportsTeam that represents a generic sports team and BasketballTeam that will represent the specific sport of basketball. mod/assign/view.php?id=752736Īpps M Gmail Tm Moodle D bellarmine email Robinhood BooksCengage Connect Powell - Our Are Voicl Methocls bad? Why Get Homework Help With Ch| + Of doubles with the win percentage, field goals percentage and freeįn2022SU CS-131-ON: Mocule Mail - Jackson B. The getStats() method should return an array Should use the formula freeThrows/freeThrowsAttempted. The formula fieldGoals/fieldGoalsAttempted. The fieldGoalPercentage() method should use ![]() ![]() ![]() The preferred constructor for this class should set all integer The getWinPercentage() method should use the The preferred constructor should set all instance fields to The empty-argument constructor should set all String instanceįields to "" and all integer instance fields to 0.
0 Comments
Leave a Reply. |