Question: Write an expression that will cause the following code to print Dollar or less if the value of numCents is less than or equal to

Write an expression that will cause the following code to print "Dollar or less" if the value of numCents is less than or equal to 100.
import java.util.Scanner;
public class Relational {
public static void main (String [] args){
int numCents =0;
Scanner input = new Scanner(System.in);
numCents = input.nextInt(); // Program will be tested with values: 98,99,100,101,102.
if (/* Your code goes here */){
System.out.println("Dollar or less");
}
else {
System.out.println("More than a dollar");

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!