Question

In an effort to improve student health care, ICU clinic has introduced a new vaccine against...

In an effort to improve student health care, ICU clinic has introduced a new vaccine against eye infection. The new vaccine is called ICUEYEINFY. All students will be vaccinated with ICUEFEINFY upon arrival for second term. Different age groups will be receiving different amounts of the vaccination. The following table shows the age groups and the amount of vaccination to receive.

Age Amount of vaccination in milliliters

15years – 20 years 500ml

21years – 25years 400ml

26years – 35years 300ml

36years and above 100ml

Write a java code that can help ICU clinic determine the amount of vaccination to give to a student by entering his/her age in your program.

Homework Answers

Answer #1

input code:

output:

code:

import java.util.*;
public class Main
{
   public static void main(String[] args) {
   /*Scanner Object*/
Scanner sc=new Scanner(System.in);
int age;
/*take input*/
       System.out.print("Enter a age: ");
       age=sc.nextInt();
       /*check age*/
       if(age>=15 && age<=20)
       {
       /*print output*/
       System.out.println("Vaccien: 500 ml");
       }
       else if(age>=21 && age<=25)
       {
       /*print output*/
       System.out.println("Vaccien: 400 ml");
       }
       else if(age>=26 && age<=35)
       {
       /*print output*/
       System.out.println("Vaccien: 300 ml");
       }
       else if(age>=36)
       {
       /*print output*/
       System.out.println("Vaccien: 100 ml");
       }
       else
       {
       /*print output*/
       System.out.println("Invalid age it should be greater than 15.");
       }
   }
}

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions