Artem H.

asked • 05/07/21

Write method to calculate Stimulus Amount. name: calculateStimulus, Parameters; Integer Array called Ages that contains ages of people &return type: void& works for any array size

Write the method to calculate Stimulus Amount:

        Method name: calculateStimulus

       Parameters:  Integer Array called Ages that contains ages of people

       Return type: void

        Logic: 1) Calculates the amount of stimulus money that is owed to each person as follows:

                     Less than 18: amount 0$

                                        18 upto 21 : amount $500,

                                         21 upto 55: amount $1000

                                         55 upto 65: amount $1500

                     More than 65: amount $2000

      2) This method prints each index and calculated amounts for example, as follows

                    Person at Index 0 : Age 43 : Amount $1000

                    Person at Index 1 : Age 12: Amount 0;

                   .... until all the persons until the last index have been calculated and printed

        Your method should work for any array size - it should calculate the size of the array and use either a for or while loop to go  through the array to calculate and print the stimulus amount that is due.  


1 Expert Answer

By:

Patrick B. answered • 05/08/21

Tutor
4.7 (31)

Math and computer tutor/teacher

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.