Question: import java.util.Scanner; public class Age { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int a; System.out.println(Input your age); a = sc.nextInt();

import java.util.Scanner;

public class Age { public static void main(String args[]) { Scanner sc = new Scanner(System.in); int a; System.out.println("Input your age"); a = sc.nextInt(); boolean mess = isAllowed(a); String mess2 = ?isAllowed(a)return"You are allowed to vote";:"You arent allowed"; String age = personAge(a); personAge(a); } public static String personAge(int age) { String mess = ""; if(age<18) return mess = "You are minor"; else if(age>=18 && age<=22) return mess = "You are legal you can vote"; else if(age>=22 && age<=60) return mess = "You are allowed to vote "; else return mess = "You are too old"; } public static boolean isAllowed(int age) { if(age>=18) return true; else return false; }

}

Can someone fix where is my code error. Please Help me.. Fix the code for me..

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!