My program seems not working right... help me fix it please. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

My program seems not working right... help me fix it please.

import java.util.Scanner; public class Diet { public static void main(String[] arga){ double H, A; char Rec, Ciz, C, N, R; 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.next().charAt(0); C=0; N=0; if(H >= 200 && A>= 21 && A<=25 && Ciz == C) { System.out.printf("Your ACCEPTED"); } else if(Ciz == N) { System.out.printf("Your REJECTED"); } System.out.print("Recommendation Jedi Master Obi Wan:"); Rec = input.next().charAt(0); R=0; N=0; if(Rec == R) { System.out.printf("Accepted Automatically"); } else if(Rec == N) { System.out.printf("Your REJECTED"); } else{ System.out.printf("There's wrong in your input!"); } } }

24th Oct 2020, 7:03 AM
Diether Absalon
Diether Absalon - avatar
3 Answers
0
I think you need to enter each number on separate lines like: 210 21 0 0 And press submit.
24th Oct 2020, 7:15 AM
QTWizard
0
21 - 25 age imean
24th Oct 2020, 7:17 AM
Diether Absalon
Diether Absalon - avatar
0
how you can enter and scan empty ' ' char (ascii 0) ? Ciz = input.next().charAt(0); C=0; if(Ciz == C)
24th Oct 2020, 8:10 AM
zemiak