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
A company that designs video games has decided to expand and needs to hire Software Developers, Web Administrators, and Computer
choli [55]
Collage graduates that are currently jobless or looking to apply for a jod
8 0
2 years ago
Read 2 more answers
Can a 3048 hp motherboard support a i7 10700k cpu?
KonstantinChe [14]

Answer:

Yes

Explanation:

6 0
2 years ago
Read 2 more answers
A ______ system writes data on two or more disks simultaneously, thereby creating a complete copy of all the information on mult
Mrrafil [7]

A raid 1 and mirrored system writes data on two or more disks simultaneously, thereby creating a complete copy of all the information on multiple drives.

<h3>What is Disk mirroring?</h3>

In data storage, disk mirroring is a term that connote the doubling of logical disk volumes into a different physical hard disks so that it will always be available.

Conclusively, Note that this is mostly used in RAID 1. A mirrored volume is known to be full logical depiction of separate volume copies and as such the answer above is correct.

Learn more about system from

brainly.com/question/25594630

8 0
2 years ago
What is the current through R1?
patriot [66]
I = V/R. So the answer is 9/200 = 0.045A = 45mA which is B
8 0
3 years ago
Pixel Data
pashok25 [27]

Answer:

-The correct width and height must be input into the pixelation widget to produce the image.

- The fact that only 32 bits were used to represent the image indicates relatively large sample squares were used. The digital image may vary from the analog image significantly.

Explanation:

8 0
3 years ago
Other questions:
  • Using Python
    14·1 answer
  • What are the main types of computer software?
    5·2 answers
  • A web browser allows you to manage computer files and programs true false
    15·1 answer
  • If you place a semicolon after the test expression in a while loop, it is assumed to be a(n) ________. a. pre-test loop b. post-
    9·1 answer
  • Can some one help sorry I just so confused on this and I keep failing it I just need the help So choose the best answers
    12·1 answer
  • A _____ is a number that summarizes an encrypted information. digital certificate hash function message digest hash algorithm
    8·1 answer
  • Write a recursive function sumAll that accepts an integer argument and returns the sum of all the integers from 1 up to the numb
    10·1 answer
  • Which best describes what databases do?
    8·2 answers
  • Discuss how a lack of infrastructure in poor communities could contribute to ill-health such as the Unrest looting.​
    9·1 answer
  • A(n) _____ is a local connection point-of-presence that connects a variety of high-performance networks, and its main function i
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!