Computers and Technology

Assuming that the valid cost should be between 100 and 200, does the following code snippet test this condition correctly?

final int MIN_COST = 100;
final int MAX_COST = 200;
int cost = 0;
Scanner in = new Scanner(System. in);
System. out. print("Please enter the cost: ");
cost = in. nextInt();
if (cost < MIN_COST)
{
System. out. println("Error: The cost is too low.");
}
else if (cost > MAX_COST)
{
System. out. println("Error: The cost is too high.");
}
else
{
System. out. println("The cost entered is in the valid cost range.");
}

answer
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 01:10, brooklynneramos9956
Problem 1 - hashing we would like to use initials to locate an individual. for instance, mel should locate the person mark e. lehr. note: this is all upper case. generate a hash function for the above using the numbers on your telephone. you know, each letter has a number associated with it, so examine your telephone keypad. generate 512 random 3 letter initials and take statistics on a linked list array size 512 to hold this information report how many have no elements, 1 element, 2 elements, does this agree with the hashing statistics distribution?
Answers: 1
image
Computers and Technology, 23.06.2019 09:10, babyskitt
Effective character encoding requires standardized code. compatible browsers. common languages. identical operating systems.
Answers: 1
image
Computers and Technology, 24.06.2019 03:00, firenation18
Click the "draw structure" button to activate the drawing utility. draw two diastereomers of (1z,4r)−1,4−dimethylcyclodecene and name them, including (e)/(z) and (r)/(s) notation. part 1 out of 4 draw the diastereomer containing a chiral center with s configuration here. window open
Answers: 1
image
Computers and Technology, 24.06.2019 04:10, kris1920
Write a program that reads a set of floating-point values. ask the user to enter the values, then print • the average of the values. • the smallest of the values. • the largest of the values. • the range, that is the difference between the smallest and largest. of course, you may only prompt for the values once.
Answers: 3
Do you know the correct answer?
Assuming that the valid cost should be between 100 and 200, does the following code snippet test thi...

Questions in other subjects: