JAVA Programming

profileDipeshb
Stockprices.txt

//TODO Add Student Information /****************************** Student Name: Student ID: Semester: COSC-1436 El Centro College Professor Keith Topic:Arrays of Objects *******************************/ import java.util.concurrent.ThreadLocalRandom; public class StockPrices { static final int MAX_STOCK_COUNT = 24; static final int MIN_STOCK_PRICE = 10; static final int MAX_STOCK_PRICE = 100; // Create the array of Stock Objects Stock[] myStocks = new Stock[MAX_STOCK_COUNT]; /** * This constructor will load the values of the stock array. * Nothing to change here. */ public StockPrices() { char startChar = 'A'; String tmpSymbol = null; int startPrice = 0; int priceRightNow = 0; for (int idx = 0; idx < MAX_STOCK_COUNT; ++idx) { // Generate stock symbol for testing tmpSymbol = "" + (char) (startChar + idx) + (char) (startChar + idx + 1) + (char) (startChar + idx + 2); // Generate random data for pricing startPrice = ThreadLocalRandom.current().nextInt(MIN_STOCK_PRICE, MAX_STOCK_PRICE + 1); priceRightNow = ThreadLocalRandom.current().nextInt(MIN_STOCK_PRICE, MAX_STOCK_PRICE + 1); myStocks[idx] = new Stock(tmpSymbol, startPrice, priceRightNow); System.out.println(myStocks[idx]); } } public void demoMethod() { System.out.println("You can call this method if you want"); System.out.println("First Stock price = "+myStocks[0].getCurrentPrice()); } //TODO /************************************************** * Assignment: * * 1. Create a method that will report the amount and symbol * of the current lowest price stock * 2. Create a method that will report the amount and symbol * of the current highest price stock * * Extra Credit - Create a method that will report the stock * with the biggest increase. *************************************************/