Sunday, September 26, 2010

Simple H1N1 diagnostic program

import java.util.Scanner;
public class ClearanceFromH1N1{
public static void main(String[] args) {
Scanner kbd = new Scanner(System.in);
char a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11;

System.out.print("Do you have fever? : ");
a1 = kbd.next().charAt(0); // Use Keyboard.readChar(); if you are using Keyboard.java

System.out.print("Do you have colds? : ");
a2 = kbd.next().charAt(0); // Use Keyboard.readChar(); if you are using Keyboard.java

System.out.print("Do you have cough? : ");
a3 = kbd.next().charAt(0); // Use Keyboard.readChar(); if you are using Keyboard.java

System.out.print("Do you have sore throat? : ");
a4 = kbd.next().charAt(0); // Use Keyboard.readChar(); if you are using Keyboard.java

System.out.print("Do you experience vomiting or nausea? : ");
a5 = kbd.next().charAt(0); // Use Keyboard.readChar(); if you are using Keyboard.java

System.out.print("Do you have diarrhea? : ");
a6 = kbd.next().charAt(0); // Use Keyboard.readChar(); if you are using Keyboard.java

System.out.print("Do you have headache? : ");
a7 = kbd.next().charAt(0); // Use Keyboard.readChar(); if you are using Keyboard.java

System.out.print("Do you have muscle or joint pains? : ");
a8 = kbd.next().charAt(0); // Use Keyboard.readChar(); if you are using Keyboard.java

System.out.print("Do you experience fatigue? : ");
a9 = kbd.next().charAt(0); // Use Keyboard.readChar(); if you are using Keyboard.java

System.out.print("Are you lacking in appetite? : ");
a10 = kbd.next().charAt(0); // Use Keyboard.readChar(); if you are using Keyboard.java

System.out.print("Did you have contact with a person with swine flu? : ");
a11 = kbd.next().charAt(0); // Use Keyboard.readChar(); if you are using Keyboard.java

if (a1=='y' || a2=='y' ||a3=='y' || a4=='y'||a5=='y' || a6=='y'||a7=='y' || a8=='y'||a9=='y' || a10=='y' || a11=='y') {
System.out.println("Please have yourself checked at the medical clinic. ");;
}
else
{
System.out.println("You are okay for now. Always take necessary precautions. ");
System.out.println("Enjoy your lessons.....");
}
System.exit(0);
}// end of main
} // end of class

No comments:

Post a Comment