write an if statement that sets the variable hours to 10 when Boolean flag variable minimum is equal to true.
(I would like to have this shown as a full fledge program pls) THANK YOU!!!!!
if (minimum == true)
hours=10;
Program to set number of hours based on minimum value.
Program:
public class MyClass {
//Main method
public static void main(String args[]) {
//Variable to store hours of type integer
int hours;
//Varible to store minimum of type boolean
boolean minimum;
//Initialising minimum. If this value is toggled, output
changes.
minimum = false;
if (minimum == true)
hours=10;
else
hours=20;
System.out.println("Hours: "+hours);
}
}
Sample Output:
Hours: 20
Get Answers For Free
Most questions answered within 1 hours.