Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

write Java statements for #8-10 on the BACK OF THIS SHEET. a person\'s age from

ID: 3723477 • Letter: W

Question

write Java statements for #8-10 on the BACK OF THIS SHEET. a person's age from the keyboard and print a message stating 8. Read in whether or not the person is old enough to vote (minimum age for voting is 18) 9. Read in a person's age from the keyboard and print a message stating hether the person is too young to drive, old enough to drive but not old enough to vote, or old enough to drive and vote (minimum driving age is 17) 10. Write the statements to read in a temperature from the keyboard and print one of the following messages: Write answeron The bac temperaturemessage > 85 68-84 45-67

Explanation / Answer

Ans:1

==============================================================

import java.util.Scanner;

public class Vote

{

public static void main(String args[])

{

Scanner in = new Scanner(System.in);

System.out.println("Enter the age: ");

int age = in.nextInt();

if(age>=18)

{

System.out.println("Person can vote.");

}

else

{

System.out.println("Person can not vote.");

}

}

}


===============================================================

Ans:2

===============================================================

import java.util.Scanner;

public class Vote

{

public static void main(String args[])

{

Scanner in = new Scanner(System.in);

System.out.println("Enter the age: ");

int age = in.nextInt();

if(age>=17)

{

System.out.println("Person is old enough to drive and vote.");

}

else

{

System.out.println("Person is too young to drive but not enough to vote .");

}

}

}


===============================================================

Ans:3

==============================================================

import java.util.Scanner;

public class Temp

{

public static void main(String args[])

{

Scanner in = new Scanner(System.in);

System.out.println("Enter the temprature: ");

int temp = in.nextInt();

if(temp>85)

{

System.out.println("hot");

}

else if(temp>=68 && temp <=84)

{

System.out.println("ideal.");

}

else if(temp >=45 && temp<=67)

{

System.out.println("cool.");

}

else if(temp < 45)

{

System.out.println("cold");

}

}

}


==============================================================

Kindly Check and Verify Thanks..!!!