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
I'm surprised I haven't even got a single warning yet lol
dangina [55]

Answer:

Thats good

Explanation:

Thanks for the points~! ;)

7 0
2 years ago
1.<br> Which of the following is NOT caused by alcohol?
Alla [95]

Answer:

What are the choices

7 0
3 years ago
Read 2 more answers
Audra is creating a training document and would like to include an image that she sees on her screen that she has marked up for
kupik [55]

Answer:

the first and last one

Explanation:

give me brainilest

4 0
3 years ago
Read 2 more answers
Plz Help!! How should I answer the second question?
Harman [31]

Answer:

Just keep doing what you were doing explain what you would be doing in the future or where you see yourself in like 5 years and put details and things that make since to you!

4 0
3 years ago
Which of the following describes the function of a web browser?
Papessa [141]

Answer:

option D.

Explanation:

A web browser is a software program that allows a user to locate, access, and display web pages. Browsers are used primarily for displaying and accessing websites on the internet, as well as other content created using languages such as Hypertext Markup Language (HTML) and Extensible Markup Language (XML).

it acts like an interface between a user and a world wide web

8 0
3 years ago
Read 2 more answers
Other questions:
  • Which of the following cannot be performed from the windows task manager?
    15·2 answers
  • The machine should not be oiled until the
    11·1 answer
  • assume an int array, candy, stores the number of candy bars sold by a group of children wherecandy[j] is the number of candy bar
    7·2 answers
  • Self contained sequences of actions to be performed are?
    6·1 answer
  • Which CSS attribute would change an element's font color to blue? font-color: blue; background: blue; color: blue; background-co
    10·2 answers
  • Grandma Ester normally gives you hugs for your birthday - one for every year old you are. When you turned 15, she squished you w
    8·1 answer
  • Emma lives in Pennsylvania, what climate does she live in?
    7·1 answer
  • is a security design principle to direct the selection of control layers for an organization's computing enclave to ensure its r
    6·1 answer
  • When you connect to an Access database, which entities are shown in the Navigator window?
    13·2 answers
  • Following Aristotle,man by nature is a political animal,justify the above claim in the light of the Russian invasion of Ukraine
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!