If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Enjoy an ad free experience by logging in. Not a member yet? Register.

Help me please!!!!!

k so im stuck on this problem in computer science, its a program that is supposed to instruct people on how to preform CPR, respond to seizures, how to administer an epi-pen, and how to clear the airway of a choking victim... anyways i have finnished writing all the code and the program said it is capable of running except when i try to run it it only asks the first question and then stops working. HELP ME PLEASE!
the code is this :

Code:

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");
}
}
}
}
}
}

Where ever you use a comparison to a string: if (variable == "Y") that must be replaced with if (variable.equals("Y")) or the other way around. .equals and .equalsIgnoreCase must be used to compare the value of strings, otherwise you are comparing object pointers.