Guest User

Untitled

a guest
Jun 18th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class VaccineTest
  4.  
  5. {
  6.  
  7. public static void main (String[] args) {
  8.  
  9. while(true){
  10. Scanner scan = new Scanner(System.in);
  11. int age;
  12. char inFlu;
  13. char pregnant;
  14.  
  15.  
  16. System.out.print("\n\tEnter your age: ");
  17. age = scan.nextInt();
  18.  
  19. System.out.print("\n\tDo you belong to a seasonal flu at-risk group? (y/n): ");
  20. inFlu = scan.next().charAt(0);
  21.  
  22. System.out.print("\n\tAre you pregnant? (y/n): ");
  23. pregnant = scan.next().charAt(0);
  24.  
  25. if ((pregnant == 'y' || pregnant == 'n') && (inFlu == 'y' || inFlu == 'n')){
  26.  
  27.  
  28. if (age<65 && inFlu == 'y')
  29. System.out.println ("Please visit your doctor between October 26th and November 6th. ");
  30.  
  31. else if (pregnant == 'y')
  32. System.out.println ("Please visit your doctor between November 9th and November 20th. ");
  33.  
  34. else
  35. System.out.println ("You do not need to be vaccinated. ");
  36.  
  37. }
  38. else
  39. System.out.println ("Input Error. Please start again. ");
  40. }
  41. }
  42.  
  43. }
Add Comment
Please, Sign In to add comment