Question: We need a program that calculates a medicine dosage by age. The following table states the amount of mg according to age ranges AGE DOSE


We need a program that calculates a medicine dosage by age. The following table states the amount of mg according to age ranges AGE DOSE (MG) 100 Greater or equal to 5 220 Write a method int findDosefint nbyears) that takes the number of years and returns the dose in mg. Write a test program that asks the user to enter the number of years (a positive, non-zero value) and prints the dose. 1-5 years PAR Problem #1: 120 pts) We need a program that calculates a medicine dosage by age. The following table states the amount of mg according to age ranges: AGE DOSE (MG) 1-5 years 100 Greater or equal to 5 220 Write a method int find Dosefint nbyears) that takes the number of years and returns the dose in mg. Write a test program that asks the user to enter the number of years (a positive, non-zero value) and prints the dose. Sample run 1 Enter number of years: 2 The medicine dosage is 100 mg Sample run 2 Enter number of years: 0 Incorrect Input! Sample run 3 Enter number of years: 7 The medicine dosage is 220 mg
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
