Question: If grade is Set School to: 1, 2, 3, 4, Primary school 6, 7, 8 Secondary school 9, 10, 11, 12 Boarding school >12 High

If grade is

Set School to:

1, 2, 3, 4,

Primary school

6, 7, 8

Secondary school

9, 10, 11, 12

Boarding school

>12

High School

the grade is an integer and school is a string. Both variables have been declared and the grade has been initialized to a value greater than or equal to 1:

public static void main (String[] args) throws java.lang.Exception { int grade = 10; //change grade as u wish String school = new String(); if(grade >= 1 && grade <= 4) { school = "Primary school"; } else if(grade >= 6 && grade <= 8) { school = "Secondary school"; } else if(grade >= 9 && grade <= 12) { school = "Boarding school"; } else if(grade > 12) { school = "High School"; } System.out.println(school); } }

1. Write code to read string (without spaces), double, and integer from a file into variables you declare using a Scanner object called input that has been instantiated and initialized.

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!