Question: Create a java following: import java.util.Scanner; // A casino class public class StockMarket { public static void main(String Args[]) { // four reference variables, trader1,
Create a java following:
import java.util.Scanner;
// A "casino" class
public class StockMarket { public static void main(String Args[]) {
// four reference variables, trader1, trader2, trader3, trader4,
// each of which references a new instance of an object of type Trader,
// created using the non-standard constructor
// set stock change percentage (stockChangePercentage) for each player (sample percentages)
// trader1 has stock change percentage of 0.61
// trader2 has stock change percentage of 0.19
// trader3 has stock change percentage of 0.81
// trader4 has stock change percentage of 0.42
// invoke the getTraderName and getStockChangePercentage methods
// for each Trader object, to retrieve that information, and print
// it to the screen
// create a variable, keyboard, of type Scanner, and set it
// equal to a new object of type Scanner, that "listens" to
// System.in // a while loop, with a "true" conditional while (true) {
// For each of the four traders, retrieve the trader's name, how much money hey/she spent,
// how much money he/she currently has, and the trader's net profit. Print that information
// to the screen. Look at the homework handout for sample output
// use a System.out.print statement to ask how much money each trader should bet.
// Then declare a variable dollarsSpend of type double, and set its value to the keyboard's
// keystroke (be sure to use keyboard.nextDouble()).
// If the user enters 0, then issue a break statement, so that the while loop terminates
// Else, invoke the tradeSomeMore method of each Trader, and pass it the variable dollarsSpend
}
}
}
![StockMarket { public static void main(String Args[]) { // four reference variables,](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f03fb26f8da_97866f03fb20f375.jpg)

AT&T 23:33 @ 100% Back Trader.java // Import the Random class import java.util. Random; // A Class that defines an object of type Trader public class Trader { 1/ fields; there are four of them, and each should be private: // // traderName of type String 11 stockChangePercentage of type double // dollarsSpent of type double // dollarsMade of type double // method: get StockChangePercentage, public // input: void // output: double // description: retrieves the value stockChangePercentage field // // method: set StockChangePercentage, public // input: percentage, which is of type double // output: void 1/ description: assign the field stockchangePercentage to percentage // // method: tradeSomeMore, public // input parameter: dollars, which is of type double // output: none W description (pseudocode): // 1) increment field dollarsSpent by input value dollars // 2) declare randomNumbers of be of type Random, and instantiate new random class 15 Dashboard Calendar To Do Notifications Inbox AT&T 23:33 @ 100% Back Trader.java 1/ 3) declare variable randomDouble of type double, and assign it the value output // by the method nextDouble() of randomNumbers // 4) if (randomDouble
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
