Write statements to accomplish each of the following tasks: a) Declare variables c, thisIsAVariable, q76354 and number
Question:
Write statements to accomplish each of the following tasks:
a) Declare variables c, thisIsAVariable, q76354 and number to be of type int and initialize each to 0.
b) Prompt the user to enter an integer.
c) Input an integer and assign the result to int variable value. Assume Scanner variable input can be used to read a value from the keyboard.
d) Print "This is a Java program" on one line in the command window. Use method Print "This is a Java program" on two lines in the command window. The first line should end with Java. Use method System.out.printf and two %s format specifiers.
e) If the variable number is not equal to 7, display "The variable number is not equal to 7".
f) If the variable number is not equal to 7, display "The variable number is not equal to 7".
Step by Step Answer:
Java How To Program Early Objects
ISBN: 9780134743356
11th Edition
Authors: Paul Deitel, Harvey Deitel