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
What does lurch mean
o-na [289]

Answer:

lurch means make an abrupt, unsteady, uncontrolled movement or series of movements; stagger.

7 0
3 years ago
Read 2 more answers
Antifreeze is not considered a hazardous waste by the EPA unless it is used or otherwise becomes contaminated.
Ahat [919]

False might be the answer

6 0
3 years ago
Read 2 more answers
An online game is played with two dice, explain why decomposition will be used in creating the algorithm for the game?
wolverine [178]
Decomposition will be used so you can break down the game into smaller and more manageable parts.
5 0
3 years ago
Read 2 more answers
) how many bits are used for host number on the child network (subnet) , b) how many usable addresses can exist on this child ne
vovikov84 [41]

Answer:

Machine’s IP=126.127.85.170, Machine’s Netmask=/27, Parent’s Netmask=255.255.240.0 .

a) Machine's Netmask = /27 : therefore no. of remaining bits for hosts =32-27 = 5 bits.

b) No. of usable addresses in the child network = 25 -2 = 32-2 =30 [Since first(network ID of the machine) and last ip (broadcast address of the machine ) addresses are not used ]

c) first usable address is on this child network (subnet) =

First, find out the network id of machine can be found out by doing bitwise AND machine's IP and Machine's subnet mask :

01111110. 01111111.01010101.10101010 (IP)

11111111. 11111111 .11111111 .11100000 (Subnet Mask)

01111110. 01111111. 01010101.10100000 (Network ID )

first usable address is on this child network (subnet) :   01111110. 01111111. 01010101.10100001

: 126.127.85.161

d) what the last usable address is on this child network (subnet) :  01111110. 01111111. 01010101.10111110

: 126.127.85.190

e) what the child network’s (subnet's) broadcast address is :

In the directed broadcast address , all the host bits are 1. Therefore, broadcast address :

01111110. 01111111. 01010101.10111111 (126.127.85.191)

f) what the child network's (subnet's) network number is : Network ID has already been calcuulated in part c .

01111110. 01111111. 01010101.10100000 (126.127.85.160)

6 0
3 years ago
To secure the company website, the webmaster suggests that the company purchase a secure certificate to encrypt all communicatio
iVinArrow [24]

Answer: Software

Explanation:

Security certificate is defined as the assurance that maintain authenticity and intactness of a website or different sites.It is present in small sized data filed that establishes encryption and validation through verification of owner's identity.

  • As per the suggestion of Webmaster, who takes care of web-pages and web-servers , security certificate should be purchased to verify the transmission of message with encryption.
  • Certificate in this case will be acting as software for providing security and operations to the websites.

4 0
3 years ago
Other questions:
  • Whenever you are passing or another vehicle is passing you, _______ is particularly important to avoid collisions. A. Turning. B
    9·2 answers
  • Enhancing and optimizing customer retention and loyalty is a major business strategy.
    15·1 answer
  • Which of these is a subdirectory? <br> HTTPS <br> /FAQ <br> .org <br> WWW
    15·1 answer
  • Please help will mark brainiest
    8·1 answer
  • Variables in PHP must begin with what symbol?
    11·1 answer
  • Erica is CEO of a company and has recently hired a vice president of marketing. She would like to share this information with al
    13·2 answers
  • Is this statement true or false?
    12·2 answers
  • Exampels of semantic tags ?​
    7·1 answer
  • Giving Brainliest IFFF CORRECT
    9·1 answer
  • Premise: Tracy has a file that contains a list of actors and the movies in which they acted. She wants to know the top 3 ranked
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!