Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

that takes as input the single argument percentage of type double. The class has a second method, keepTrading, that takes as input the single argument

image text in transcribedimage text in transcribed

that takes as input the single argument percentage of type double. The class has a second method, keepTrading, that takes as input the single argument dollars, of type double. The method keepTrading: generates a random number checks if that number is more or less than the Trader's stockChange Percentage: depending on the outcome, the method prints out to the console "made" or "lost". If a Trader makes money a round, the Trader's dollarsMade is incremented by 2 times the Trader's dollars. If a trader losses, they loose 3 times the amount od dollars being traded. Five additional methods, getTraderName, getDollarspent, getStockchange Percentage, getDollarsMade, and getNet Profits, take no input parameters, and return a String, double, double, double, and double, respectively. The Trader class non-default constructor takes a single argument, name, of type String. See the skeleton of Trader.java, which explains each field, and the methods, in general. The UML diagram for the Trader class is shown below: Trader - trader Name : String - stockChangePercentage: double dollars Spent : double - dollars Made: double + getStockChangePercentage(): double + setStockChangePercentage(stockChangePercentage : double) : void + keep Trading(dollarsBet : double): void + getTraderName(): String + getDollarsSpent(): double + getDollars Made(): double + getNetProfit(): double + Trader(name : String): A sample invocation of the program is shown in Figure 1, in which there are three rounds of playing the stock market. In the first round, $300 is bet by each player. In the second and third rounds, $160 and S1000 is bet by cach player. Each player has a different chance of making money, and by the end of the three rounds of trading, two of the Traders have a negative net gain, and the player Happy, has a net of S800. that takes as input the single argument percentage of type double. The class has a second method, keepTrading, that takes as input the single argument dollars, of type double. The method keepTrading: generates a random number checks if that number is more or less than the Trader's stockChange Percentage: depending on the outcome, the method prints out to the console "made" or "lost". If a Trader makes money a round, the Trader's dollarsMade is incremented by 2 times the Trader's dollars. If a trader losses, they loose 3 times the amount od dollars being traded. Five additional methods, getTraderName, getDollarspent, getStockchange Percentage, getDollarsMade, and getNet Profits, take no input parameters, and return a String, double, double, double, and double, respectively. The Trader class non-default constructor takes a single argument, name, of type String. See the skeleton of Trader.java, which explains each field, and the methods, in general. The UML diagram for the Trader class is shown below: Trader - trader Name : String - stockChangePercentage: double dollars Spent : double - dollars Made: double + getStockChangePercentage(): double + setStockChangePercentage(stockChangePercentage : double) : void + keep Trading(dollarsBet : double): void + getTraderName(): String + getDollarsSpent(): double + getDollars Made(): double + getNetProfit(): double + Trader(name : String): A sample invocation of the program is shown in Figure 1, in which there are three rounds of playing the stock market. In the first round, $300 is bet by each player. In the second and third rounds, $160 and S1000 is bet by cach player. Each player has a different chance of making money, and by the end of the three rounds of trading, two of the Traders have a negative net gain, and the player Happy, has a net of S800

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Administrator Limited Edition

Authors: Martif Way

1st Edition

B0CGG89N8Z

More Books

Students also viewed these Databases questions

Question

2. Write two or three of your greatest weaknesses.

Answered: 1 week ago