subject

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.

ansver
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 20:40, wutdmgamerz
Assume that there is a 4% rate of disk drive failure in a year. a. if all your computer data is stored on a hard disk drive with a copy stored on a second hard disk drive, what is the probability that during a year, you can avoid catastrophe with at least one working drive? b. if copies of all your computer data are stored on three independent hard disk drives, what is the probability that during a year, you can avoid catastrophe with at least one working drive?
Answers: 1
image
Computers and Technology, 23.06.2019 18:40, brooklyn4932
How does is make you feel when you're kind to others? what are some opportunities in your life to be more kind to your friends and loved ones? imagine a world where kindness has be outlawed. how would people act differently? would your day-to-day life change significantly? why or why not?
Answers: 2
image
Computers and Technology, 25.06.2019 08:10, mil3ndy
What is the relation between information and data?
Answers: 3
image
Computers and Technology, 25.06.2019 09:30, mustafajibawi1
1. write a statement that declares a string variable named city. the variable should be initialized so it references an object with the string “san francisco”. a) assume that stringlength is an int variable. write a statement that stores the length of the string referenced by the city variable (declared in question1) in stringlength. b) assume that onechar is a char variable. write a statement that stores the first char- acter in the string referenced by the city variable (declared in question1) in onechar. c) assume that uppercity is a string reference variable. write a statement that stores the uppercase equivalent of the string referenced by the city variable (declared in question 1) in uppercity. d) assume that lowercity is a string reference variable. write a statement that stores the lowercase equivalent of the string referenced by the city variable (declared in question 1) in lowercity.
Answers: 3
You know the right answer?
1. the program should have the following specifications:
a. declare variables x, y and z with...

Questions in other subjects:

Konu
Mathematics, 09.01.2022 06:20
Konu
English, 09.01.2022 06:20
Konu
History, 09.01.2022 06:20