Question: Create a method that has the following signature public static int pandemic(int numOfCases, byte dailyIncreaseRate, char today) It takes three parameters, the current number of

Create a method that has the following signature

public static int pandemic(int numOfCases, byte dailyIncreaseRate, char today)

It takes three parameters, the current number of covid-19 cases, the daily % rate of increase of cases (range 1 to 100 inclusive), and the current day (one of M T W R F S U) and returns the number of days it will take for the current number of cases to double. The dailyIncreaseRate is not constant though. On the weekends, due to increased social activity, it gets higher. Specifically, on Saturdays (S) it is doubled, and on Sundays (U) it is tripled. For example, if the dailyIncreaseRate is 5%, it will become 10% on Saturdays and 15% on Sundays. Assume that you will run the calculation starting from today.

Examples

 pandemic(100, 10, 'T') --> 5 // Tuesday: 100 cases -> Wednesday: 110 cases (10% increase) -> Thursday: 121 cases (10% increase) -> Friday: 133 cases (10% increase) -> Saturday: 159 cases (20% increase) -> Sunday: 206 cases (30% increase) pandemic(500, 8, 'T') --> 7 // Tuesday: 500 cases -> Wednesday: 540 cases (8% increase) -> Thursday: 583 cases (8% increase) -> Friday: 629 cases (8% increase) -> Saturday: 729 cases (16% increase) -> Sunday: 903 cases (24% increase) -> Monday: 975 cases (8% increase) -> Tuesday: 1053 cases (8% increase)

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!