1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Alenkasestr [34]
3 years ago
9

Write a single Java if-else statement that outputs the value of a char variable GRADE if GRADE is equal to 'A' or 'B' or 'C' or

'D' or 'F'; otherwise, output the message "Input Error".
Computers and Technology
1 answer:
ad-work [718]3 years ago
3 0

Answer:

Following are the program in java is given below

import java.util.*; // import package

public class Main // main class

{

public static void main(String[] args) // MAIN FUNCTION

{

Scanner scan2 = new Scanner(System.in);// scanner CLASS

System.out.println("Enter the Grade ");

char GRADE = scan2.next().charAt(0);//Read input by user

if(GRADE=='A' || GRADE=='B' || GRADE=='C' || GRADE=='D' || GRADE=='F' ) // //CHECK CONDITION

{    

System.out.println("The GRADE is :" +GRADE); // display grade  

}

else // Else block

{

System.out.println(" Input Error"); // display message

}

}

}

Output:

Enter the Grade

D

The GRADE is :D

Explanation:

Following are the description of program

  • Create the object of scanner class for read the value of grade by the user .
  • Read the value of "GRADE" variable by using the scanner class object  scan 2
  • Now check the condition in if block if the "GRADE" is  'A' or 'B' or 'C' or 'D' or 'F' then display the value of the GRADE variable otherwise else block is executed and input error message is displayed .

You might be interested in
Pick the correct characteristics that define the porous inkjet paper.
Arisa [49]

Answer:

"Porous inkjet paper produces high-quality photos." and "Porous paper fades and scratches easily."

Explanation:

i took the test

4 0
3 years ago
Database accessibility DBA writes subschema to decide the accessibility of database.
Crank
The answer would be true
8 0
3 years ago
Read 2 more answers
Write a short essay on the importance of information and communication technology (ICT) in the AFN industry. Add suitable exampl
AURORKA [14]

Answer:

computer

Explanation:

is an ICT device that help and makes things or work easy

6 0
3 years ago
The first row in a table is referred to as the _____ row and the last row is considered the _____ row.
Juliette [100K]

the first row in a table is classed as the header row.

and with the last one I'm not sure because as far as I know there's not considered a last row.

6 0
3 years ago
When you are fit, you can exercise and do physical work without getting too tired. A. True B. False\
enot [183]

Answer:

A.

Explanation:

But all of us get tired

3 0
3 years ago
Read 2 more answers
Other questions:
  • If you want to copy text formatting from one area of your document to another area, _____.
    5·2 answers
  • Laura is confused with the spelling of the word pronunciation. She types the word pronunciation. Which feature of the auto corre
    8·2 answers
  • List 5 different programming languages calls to print
    8·2 answers
  • The third wave of computing was characterized by the introduction of _____.
    10·1 answer
  • Which of the following is no longer necessary when you use HTML5 to develop Webpages? Please Hurry This Is For An Assignment due
    13·1 answer
  • Which are characteristics of an effective solution? Choose all that apply. solves the problem in anticipated ways each time resu
    5·1 answer
  • Which network component blocks status?
    9·1 answer
  • Project light with a system of lenses used for projecting slides or film into a screen.
    5·1 answer
  • When working with track changes, what is the difference between simple markup and all markup?
    14·1 answer
  • Looking for similarities between concepts or problems is referred to as
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!