1. the program should have the following specifications:
a. declare variables x, y and z with...
Computers and Technology, 18.09.2019 20:10 bxymichelle
1. the program should have the following specifications:
a. declare variables x, y and z with ‘int’ data types without initializing them.
b. the program should accept inputs for the declared variables as follows:
x=0; y=0; and z=0
c. using the if statement, implement the following constraints:
i. check if the value of variable x and y are equal then increment the value of x by 1.
ii. check if the value of variable x and z are equal then increment the value of x by 1
iii. check if the value of variable y and z are equal then increment the value of y and z by the value x.
d. print the sum of all variables.
e. save, compile and run the program.
1: what is the current value of variable x?
a: 0
b: 1
c: 2
d: 3
2: what is the current value of variable y?
a: 0
b: 1
c: 2
d: 3
3: what is the current value of variable z?
a: 0
b: 1
c: 2
d: 3
4: what is the output of the program?
a: 0
b: 2
c: 4
d: 6
2. modify the java file that you have created by adding the following codes in your main method:
while(y< =5) {
x++;
y++;
z++;
}
a. print the sum of all variables.
b. save, compile and run the program.
5: what is the current value of variable x?
a: 5
b: 6
c: 7
d: 8
6: what is the current value of variable y?
a: 5
b: 6
c: 7
d: 8
7: what is the current value of variable z?
a: 5
b: 6
c: 7
d: 8
8: what is the output of the program?
a: 15
b: 16
c: 17
d: 18
e: none of the above
3. open the file again and add the following codes in the main method:
for(y = 1; y
{
y=x;
}
system. out. print(y);
a. save, compile and run the program.
9: what is the current value of variable y?
a: 5
b: 6
c: 7
d: 8
10: what is the output of the program?
a: 5
b: 6
c: 7
d: 8
e: none of the above
4. write java program for a temperature converter with the following specifications:
a. the program should display a menu as follows:
temperature converter main menu
[1] conversion from celsius to fahrenheit
[2] conversion from fahrenheit to celsius
[3] exit
choose an option
b. option 1 should ask for a temperature input and convert it to fahrenheit. display the converted temperature. assume that the user will only input numerical value.
c. option 2 should ask for a temperature input and convert it to celsius. display the converted temperature. assume that the user will only input numerical value.
d. the program returns to the main menu after each display from the option, and when an invalid input of the option is encountered.
e. validate the option input. only 1, 2 and 3 are acceptable, otherwise, display a message error and return to the main menu.
f. exit option terminates the program.
Answers: 2
Computers and Technology, 22.06.2019 00:00
Ahorse is how much percent more powerful than a pony
Answers: 1
Computers and Technology, 22.06.2019 23:00
Is an attack that relies on guessing the isns of tcp packets
Answers: 2
Computers and Technology, 23.06.2019 09:30
The place where the extended axis of the earth would touch the celestial sphere is called the celestial
Answers: 1
Computers and Technology, 23.06.2019 14:30
Which of the following would not be considered a pc? a. mainframe b. desktop c. tablet pc d. laptop
Answers: 2
Engineering, 13.12.2021 14:40
World Languages, 13.12.2021 14:40
Mathematics, 13.12.2021 14:40
Chemistry, 13.12.2021 14:40
Biology, 13.12.2021 14:40
English, 13.12.2021 14:40
Mathematics, 13.12.2021 14:40
English, 13.12.2021 14:50
Mathematics, 13.12.2021 14:50
Biology, 13.12.2021 14:50
Business, 13.12.2021 14:50
English, 13.12.2021 14:50
Health, 13.12.2021 14:50
Mathematics, 13.12.2021 14:50