Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class VaccineTest
- {
- public static void main (String[] args) {
- while(true){
- Scanner scan = new Scanner(System.in);
- int age;
- char inFlu;
- char pregnant;
- System.out.print("\n\tEnter your age: ");
- age = scan.nextInt();
- System.out.print("\n\tDo you belong to a seasonal flu at-risk group? (y/n): ");
- inFlu = scan.next().charAt(0);
- System.out.print("\n\tAre you pregnant? (y/n): ");
- pregnant = scan.next().charAt(0);
- if ((pregnant == 'y' || pregnant == 'n') && (inFlu == 'y' || inFlu == 'n')){
- if (age<65 && inFlu == 'y')
- System.out.println ("Please visit your doctor between October 26th and November 6th. ");
- else if (pregnant == 'y')
- System.out.println ("Please visit your doctor between November 9th and November 20th. ");
- else
- System.out.println ("You do not need to be vaccinated. ");
- }
- else
- System.out.println ("Input Error. Please start again. ");
- }
- }
- }
Add Comment
Please, Sign In to add comment