JAVA
java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import java.util.Scanner;
public class Voting
{
public static void main(String[] args) {
/*Enter age from range 1 to 104*/
Scanner sc = new Scanner(System.in);
int age = sc.nextInt();
sc.nextLine() ;
System.out.println(">Ur age is "+"*"+age+"*"+".");
/*Make sure to enter any number below even if ur age is below 16 */
if (age > 0 && age <= 12){
System.out.println("Why r u even here ? U can't vote");}
else if (age > 12 && age < 16){
System.out.println("U still have some time left.");}
else if (age >= 16 && age <=104){
System.out.println("U can vote.");
}else{
System.out.println("Error.");
}
if (age>=16 && age<=104) {
System.out.println(">Whom would u like to vote ?");
System.out.println("¦Joe Biden¦");
System.out.println("¦Barak Obama¦");
Enter to Rename, Shift+Enter to Preview
OUTPUT
Exécuter