Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Stimulus distribution Create one class with a main method and at least two additional methods. Ask the user for two positive integers. The first number

Stimulus distribution

Create one class with a main method and at least two additional methods.

Ask the user for two positive integers. The first number is the bottom of the range and the second is the top of the range.

Create and call a method that takes the two numbers as arguments and generates a random number within that range and returns it.

Create and call a second method that takes the number just generated and distributes the money in the following way:

This method breaks the money down into four categories: Transportation, wages, food, business.

Generate a random number between 0 and 0.25. Multiply the input number by this percent to get a total for Transportation.

Example: if the input number is 1000 and the random value is 0.14 then transportation would get 140.

Do the same for the next two categories: wages and food resulting in three percentages and three-dollar values.

You will need to keep track of the running total to compute the last category. The last category, business, gets the left-over money after the first three categories are calculated. For instance, if the first three values are:

Transportation 22%

Wages 18%

Food 9%

Then the business percent is 100 -22 -18 9 = 51%.

And the business value for an input of 1000 is 510.

Print out the results in dollars.

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