Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is the program we have to write for java: /*Write an application that computes a businesss potential profits each year for 20 years using

This is the program we have to write for java: /*Write an application that computes a businesss potential profits each year for 20 years using the following assumptions: (1) Gross profit in the first year is projected to be $20,000. (2) Expenses in the first year are expected to be $35,000. (3) Net profit or loss is gross profit minus expenses. (4) Gross profits are expected to increase 10 percent each year. (5) Expenses are expected to increase 4 percent each year. Display the year, the gross profit, the expenses, and the net profit for each year. Also display the year in which a net profit is first reported. Save the file as WhenProfitable.java.*/

Here is what I have done so far and now my brain has gone into a fog! (It HAS to read out the whole 20 years of stats & then display the year of the first profit)

public class WhenProfitable { public static void main(String args[]) { final int MaxYear = 20; double grossProfit = 20000, expenses = 35000, netProfit = 0; int year = 0; int firstYear = 0;

while(year

System.out.println("Year: "+year+" Gross Profit: "+grossProfit+" Expenses: "+expenses+" NetProfit: "+netProfit);

if(netProfit > 0 && year == 20) { System.out.println("In year "+ firstYear+" the first net profit was reported"); break; } } } }

image text in transcribed

C. Command Prompt C:\Program Files\Java\My Classes Tests>javac WhenProfitable.java C:\Program Files\Java\My classes Tests>java WhenProfitable Year: 1 Gross Profit: 22000.0 Expenses: 36400.0 NetProfit: - 15000.0, Year: 2 Gross Profit: 24200.0 Expenses: 37856.0 NetProfit: -14400.0 Year: 3 Gross Profit: 26620.0 Expenses: 39370.24 NetProfit: -13656.0 Year: 4 Gross Profit: 29282.0 Expenses: 40945.0496 NetProfit: - 12750.239999999998 Year: 5 Gross Profit: 32210.2 Expenses: 42582.851584 NetProfit: -11663.049599999998 Year: 6 Gross Profit: 35431.22 Expenses: 44286. 165647359994 NetProfit: -10372.6515839999961 Year: 7 Gross Profit: 38974.342000000004 Expenses: 46057.612273254395 NetProfit: -8854.945647359993 Year: 8 Gross Profit: 42871.77620000001 Expenses: 47899.91676418457 NetProfit: -7083.270273254391, Year: 9 Gross Profit: 47158.95382e0e001 Expenses: 49815.91343475195 NetProfit: -5028. 140564184565 Year: 10 Gross Profit: 51874.84920200001 Expenses: 51808.54997214203 NetProfit: -2656.9596147519405 Year: 11 Gross Profit: 57062.334122200016 Expenses: 53880.89197102771 NetProfit: 66.29922985798476 Year: 12 Gross Profit: 62768.56753442002 Expenses: 56036.12764986882 NetProfit: 3181.442151172305 Year: 13 Gross Profit: 69045.42428786203 Expenses: 58277.57275586357 NetProfit: 6732.439884551204, Year: 14 Gross Profit: 75949.96671664822 Expenses: 60608.67566609811 NetProfit: 10767.851531998458 Year: 15 Gross Profit: 83544.96338831304 Expenses: 63033.02269274204 NetProfit: 15341.291050550113 Year: 16 Gross Profit: 91899.45972714435 Expenses: 65554.34360045171 NetProfit: 20511.940695571007, Year: 17 Gross Profit: 101089.40569985879 Expenses: 68176.51734446979 NetProfit: 26345. 116126692636 Year: 18 Gross Profit: 111198.34626984467 Expenses: 70903.57803824858 NetProfit: 32912.888355389005 Year: 19 Gross Profit: 122318.18089682913 Expenses: 73739.72115977852 NetProfit: 40294.768231596085 Year: 20 Gross Profit: 134549.99898651204 Expenses: 76689.31000616966 NetProfit: 48578.45973705061, In year 20 the first net profit was reported C:\Program Files\Java\My Classes Tests Type here to search o # 0 9 D ^ 1) 2725/2020 F2

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

More Books

Students also viewed these Databases questions