0

help me fix it can't run it properly

import java.util.Scanner; public class Diet { public static void main(String[] arga){ double H, A, Ciz, Rec; Scanner input = new Scanner(System.in); System.out.print("Enter the Height: "); H=input.nextDouble(); System.out.print("Enter the Age: "); A=input.nextDouble(); System.out.print("Enter the Citizenship: "); Ciz=input.nextDouble(); if(H >= 200 && A>= 21 && A<=25 && Ciz == C) { System.out.printf("Your ACCEPTED"); } System.out.print(" Recommendation Jedi Master Obi Wan"); Rec=input.nextDouble(); else if(Rec == R) { System.out.printf("Accepted Automatically"); } else{ System.out.printf("Your REJECTED"); } } }

23rd Oct 2020, 12:40 PM
Diether Absalon
Diether Absalon - avatar
2 Respuestas
+ 1
Adding : you are also not defined R, C variables.. Which are you using in if conditions.. Define and give values.. & To work it correctly add only 'if' instead of 'else if'.
23rd Oct 2020, 1:08 PM
Jayakrishna 🇮🇳
0
You wrongly placed your else if statement. A else if statement is valid only if it's placed right after a if statement. Hope this helps.
23rd Oct 2020, 12:49 PM
Leon lit
Leon lit - avatar