The software I'm using is: https://ready-to-program-with-java.software.informer.com/1.7/ use the software to fix the errors and do the code.
Question:
The software I'm using is: https://ready-to-program-with-java.software.informer.com/1.7/
use the software to fix the errors and do the code.
My code is:
Import java.Util.Scanner; Import java.Util.Random; /** * This class performs a week simulation of a lemonade stand * prompting the person to select elements based totally on prices and * daily income are simulated based on weather. * *
insects: none recognised, now not strong towards non-integer input * * @writer Erin Rasmussen */ Public class LemonadeStand /** * because this is a one method program, this method plays the whole lot * indexed inside the comment on the class. */ public static void most important(String[] args) //declare any variables Scanner stdIn = new Scanner(system.In); int cash, unitsOfLemons, unitsOfSugar, lemonCost, sugarCost, possibleCups, seed; int lemonPurchase, sugarPurchase, spoiled, weather, clients, cupsSold, earnings; /* cash: the amount of cash a participant has, starts offevolved at a thousand, constantly >= 0 * unitsOfLemons: general supply of lemons, >= 0 * unitsOfSugar: total supply of sugar, >= 0 * lemonCost: cost of lemons decided randomly, 15 to 35 * sugarCost: price of sugar decided randomly, 15 to twenty-five * possibleCups: most cups based totally on lemon and sugar deliver, >= 0 * seed: the seed acquired from the consumer to randomize the game * lemonPurchase: amount of lemons purchased each day, >= 0 * sugarPurchase: quantity of sugar purchased each day, >= zero * spoiled: the quantity of lemons spoiled (1/four of remaining), >= zero * climate: random integer to assign unique weather for a day, [0-3] * customers: maximum quantity of customers primarily based on weather, 10, 20, 30, or forty * cupsSold: quantity of cups offered each day, zero to 40 * earnings: the amount of money made for the duration of each day of sales, >= 0 */ cash = 1000; unitsOfLemons = 0; unitsOfSugar = 0;
//get seed price from user for growing random number generator system.Out.Println("Please input a variety of to randomize the game: "); seed = stdIn.NextInt(); Random rand = new Random(seed);
//begin day loop for (int day = 1; day <= 14; day++) gadget.Out.Println("Day " + day); //print day by day record gadget.Out.Println("money: " + money); system.Out.Println("Lemons: " + unitsOfLemons); device.Out.Println("Sugar: " + unitsOfSugar + "n"); //generate value of lemons and sugar lemonCost = rand.NextInt(21) + 15; sugarCost = rand.NextInt(11) + 15; device.Out.Println("The fee of lemons is " + lemonCost); device.Out.Println("The fee of sugar is " + sugarCost);
//purchase lemons machine.Out.Println("enter the amount of lemons you would love. The price" + " is " + lemonCost + " per lemon."); lemonPurchase = stdIn.NextInt(); whilst (cash - (lemonPurchase * lemonCost) < zero0) //preceding announcement turned into used to forestall invalid input, negative money or elements device.Out.Println("You can not buy this many, please select once more."); lemonPurchase = stdIn.NextInt(); //replace cash and lemon supply unitsOfLemons = unitsOfLemons + lemonPurchase; money = money - (lemonCost * lemonPurchase);
//print money supply system.Out.Println("After buying lemons, you have got " + money + " in cash.");
//purchase sugar gadget.Out.Println("input the amount of sugar you would like. The fee" + " is " + sugarCost + " consistent with unit of sugar."); sugarPurchase = stdIn.NextInt(); whilst (money - (sugarPurchase * sugarCost) < 0 sugarPurchase < zero) //preceding assertion was used to forestall invalid enter, terrible cash or materials system.Out.Println("You can not buy this an awful lot, please choose once more."); sugarPurchase = stdIn.NextInt(); //update money and sugar deliver unitsOfSugar = unitsOfSugar + sugarPurchase; cash = money - (sugarCost * sugarPurchase);
//print money deliver system.Out.Println("After purchasing sugar, you've got " + cash + " in money.");
//measure elements and print wide variety of cups viable if (unitsOfSugar <= unitsOfLemons) possibleCups = unitsOfSugar; else possibleCups = unitsOfLemons; //1 unit of sugar and lemons are required, the max. Possible cups is the min. Of the 2 //generate random weather weather = rand.NextInt(four); switch (climate) case zero: device.Out.Println("state-of-the-art weather is cool."); clients = 10; damage; case 1: device.Out.Println("modern day climate is common."); clients = 20; wreck; case 2: system.Out.Println("ultra-modern climate is warm."); customers = 30; wreck; case three: gadget.Out.Println("modern-day weather is hot."); customers = forty; destroy; default: clients = 0; break;
//calculate cups sold if (possibleCups <= clients) cupsSold = possibleCups; earnings = 50 * cupsSold; money = cash + earnings; else cupsSold = clients; income = customers * 50; money = cash + earnings; //amount of cups bought is the minimal between possibleCups and customers //replace lemon and sugar supply based totally on cups sold unitsOfLemons = unitsOfLemons - cupsSold; unitsOfSugar = unitsOfSugar - cupsSold;
//report cups sold and money made device.Out.Println("these days you bought " + cupsSold + " cups of lemonade and" + " made " + earnings + " in cash.");
//update money supply system.Out.Println("you have " + money + " in money after day " + day + ".");
//compute deliver of lemons spoiled, print message and update deliver if (unitsOfLemons != 0) spoiled = (unitsOfLemons / four); unitsOfLemons = unitsOfLemons - spoiled; machine.Out.Println("because of spoilage, you lost " + spoiled + " lemons." + "n"); else system.Out.Println("you have no lemons left, therefore no spoilage has occured." + "n"); //give up day loop //stop for //print end-of-sport record machine.Out.Println("After 2 weeks of income, you have got " + cash + " in money closing" + ", " + unitsOfLemons + " lemons last, and " + unitsOfSugar + " devices of sugar closing.");
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill