Question: /* I am trying to run a java program that does the simulation from the picture below. Here's what I have so far but i

/* I am trying to run a java program that does the simulation from the picture below. Here's what I have so far but i got stuck. I need help running the program that allows me to simulate up to whatever number of days I enter like like 1,000,000 days for example. */ package; import java.util.Random; import java.util.Scanner;

public class { public static void main(String[] args) { int NUM_DAYS=0; //The number of days to simulate int NUM_BUY=0; //The number of news papers to buy each day double totalProfit=0;//Total profit double priceBuy=0.33; //The price of each paper to buy double priceSell=0.50;//The price of each paper to sell double priceRecycle=0.05;//The price of each paper to recycle int dayDemand; //Number of papers demanded for the day int randDayType, randGoodDay, randFairDay, randPoorDay; Random rand=new Random();//Create an Object of the Random class //that will be used to generate random integers Scanner scan=new Scanner(System.in);//Create an object for input from keyboard System.out.println("Enter the number of papers to buy and press the enter key: "); NUM_BUY=scan.nextInt();//Read and store the integer entered System.out.println("Enter the number of days to simulate and press the enter key:"); NUM_DAYS=scan.nextInt();//Read and store the integer entered System.out.println("This program simulates "+NUM_DAYS+ " days with "+NUM_BUY+" papers to buy each day."); for(int i=0; i=4 &&randGoodDay=9 &&randGoodDay=24 &&randGoodDay=44 &&randGoodDay=79 &&randGoodDay35 && randDayType=11 &&randFairDay=29 &&randFairDay=69 &&randFairDay=89 &&randFairDay=97 &&randFairDay

if(randPoorDay=45 &&randPoorDay=67 &&randPoorDay=83 &&randPoorDay=95 &&randPoorDaynumBuy) return numBuy*p-(dayDemand-numBuy)*p; return dayDemand*p+(numBuy-dayDemand)*(priceRecycle-priceBuy); }

} /* I am trying to run a java program that does the

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!