Question: Problem #3: (20 pts Write a method with the following header: void getListofVaccines(int age) The method takes as parameter the age of a baby born

 Problem #3: (20 pts Write a method with the following header:

Problem #3: (20 pts Write a method with the following header: void getListofVaccines(int age) The method takes as parameter the age of a baby born (0 to 7 months) and prints the recommended list of vaccines as follows: If the baby's age is 4 months or less, the vaccines are "Hepatitis, Pneumococcal vaccine" If the baby's age is between 5 and 7 months (inclusive), the vaccine is "Influenza vaccine" Otherwise, the following message is displayed: "The age should be between 0 and 7 months" b) Write a test program that prompts the user to enter the ages for n babies. The program then invokes the above method to display the list of vaccines. Sample run 1: Enter number of babies: -5 Wrong entry Sample run 2 : Enter number of babies: 4 Enter an age (0 to 7 months): 10 The age should be between 0 and 7 months Enter an age (0 to 7 months): 2 The vaccines are HepatitisB, Pneumococcal vaccine Enter an age (0 to 7 months): -4 The age should be between 0 and 7 months Enter an age (0 to 7 months): 6 The vaccine is Influenza vaccine

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!