Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jun 2012
    Posts
    4
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Java Script Project I need HELP!!!!!

    hey so im writing this program that is supposed to help in first aid situations like CPR, Seizures, Allergic Reactions, and Choking. i wrote and compiled the code and it says there are no syntax errors but when i try to run the code, it asks the first question then ends itself and doesnt continue to ask questions or give answers. Help would be much appreciated the code is:

    import java.util.Scanner;

    public class Emergency{
    public static void main(String[] args){
    Scanner user_input=new Scanner(System.in);

    String Y;
    String N;
    String Child;
    String Infant;
    String Adult;
    String Seizure;
    String Allergies;
    String Choking;
    String Answer;
    String Answertwo;
    String Answerthree;

    System.out.println("Is the victim unconscious? Y / N");
    Answer=user_input.next();

    if(Answer=="Y" && Answer=="y"){
    System.out.println("Call EMS, and Asses vital signs by checking for breathing for 10 seconds, and assess circulation by placing your index and middle finger on the pulse which is located at base of right jaw bone, and feel for ten seconds then answer: is there a pulse or any breathing? Y / N");
    Answertwo=user_input.next();

    if(Answertwo=="Y"&&Answertwo=="y"){
    System.out.println("If yes then tell the person to begin treating for shock and wait for EMS to arrive: to treat for shock reassure the victim and provide a warm blanket if necessary and routinely check vital signs. And search for medical bracelets, and anything that could of caused this and update the EMS call and gather as much information as possible.");
    }
    else{
    if(Answertwo=="N"&&Answertwo=="n"){

    System.out.println("is this an Infant< 1-11 months > a Child < 1-6 years > or an Adult <6 years +>");
    Answerthree=user_input.next();

    if(Answerthree=="Infant"&&Answerthree=="infant"){
    System.out.println("Place 2 fingers between the two nipples on the middle of the chest and proceed to give 30 chest compressions, to preform a chest compression u must push down on the chest. Then blow two check full of air into its lungs. Then asses vitals. To asses a vital sign listen& look for breathing, vomit, wheezing, repeat these steps until EMS arrives.");
    }
    if(Answerthree=="Child"&&Answerthree=="child"){
    System.out.println("Place 1 hand between the two nipples on the middle of the chest and proceed to give 30 chest compressions, to preform a chest compression u must push down on the chest around 1-1.5inches. then give victim two short breaths then asses vitals. To asses a vital sign listen& look for breathing, vomit, wheezing, repeat these steps until EMS arrives.");
    }
    if(Answerthree=="Adult"&&Answerthree=="adult"){
    System.out.println("Place 2 hands on top of each other between the two nipples on the middle of the chest and proceed to give 30 chest compressions, to preform a chest compression u must push down on the chest around 1.5-12 inches. Then give victim two breaths then asses vitals. To Asses a vital sign listen& look for breathing, vomit, wheezing, Repeat these steps until EMS arrives or levels of consciousness improve.");
    }
    }
    }
    }
    else if(Answer=="N"&&Answer=="n"){



    System.out.println("Is the Victim having a Seizure? Y / N");
    Seizure=user_input.next();
    if(Seizure=="Y"&&Seizure=="y"){
    System.out.println("Support head & neck and try to pad area around seizing victim, DO NOT TRY TO MOVE THEM, this can further cause injury, Seizures are traumatic and last for around 30 seconds and in that time the victim is conscious and scared, they are caused from head trauma or a disease called epilepsy check for a bracelet that says epileptic on it and call EMS as soon as possible!.");
    }
    if(Seizure=="N"&&Seizure=="n"){
    System.out.println("Is the Victim having an Allergic Reaction? Y / N");
    Allergies=user_input.next();
    if(Allergies=="Y"&&Allergies=="y"){
    System.out.println("Find and locate epi pen, and do not place fingers or thumbs over the ends because most are spring-loaded and many people have been stabbed by epi pens! There will be two sides and use the side that is marked epi pen, then inject the pen into thigh of child and hold for 10 seconds, then remove and message the area for 15 more seconds. The second side of the pen is an extra dose of epinephrine < a type of adrenaline >. Call EMS immediately!");
    }
    if(Allergies=="N"&&Allergies=="n"){
    System.out.println("Is the Victim Choking? Y / N");
    Choking=user_input.next();
    if(Choking=="Y"&&Choking=="y"){
    System.out.println("Bend victim over an arm facing the ground, and give 5 back blows: to do this hit victim 5 times between the shoulder blades with the bottom of your palm, then give 5 abdominal thrusts to do this: make one and into a fist and place the other hand around it then place your hands on the persons abdomen and proceed to pull upward under the rip cage in 5 thrusting motions. Repeat these steps until victim coughs up food or goes unconscious. Call EMS ASAP. If victim goes unconscious proceed to follow the procedure that was directed from the program. ");
    }
    else{
    System.out.println("Sorry this program can't help you");
    }
    }
    }
    }
    }
    }
    P.S: i have to use text edit because my computer science teacher is an idiot and can't answer any questions

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,861
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Lesson 1 : This is Javascript forum and

    Java != Javascript

    You may request a moderator to move your thread to the right forum.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •