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

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 Solution

3.36 Rating (149 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

a int c 0 intthisIsAVariable 0intq76354 0 int number 0 ... View full answer

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 Java How to Program Early Objects Questions!