Computers and Technology

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.

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 21:40, minnie7760
Draw the resistor’s voltage and current phasors at t=15ms. draw the vectors with their tails at the origin. the orientation of your vectors will be graded. the exact length of your vectors will not be graded.
Answers: 2
image
Computers and Technology, 24.06.2019 10:50, latresyn
In 2009 to 2010, how many social network users were reported as being victims of online abuse? a. 1 in 10 b. 100% c.1 in 100 d. 50%
Answers: 2
image
Computers and Technology, 24.06.2019 14:40, drecooks713
Create a function (prob3_6) that will do the following: input a positive scalar integer x. if x is odd, multiply it by 3 and add 1. if the given x is even, divide it by 2. repeat this rule on the new value until you get 1, if ever. your program will output how many operations it had to perform to get to 1 and the largest number along the way. for example, start with the number 3: because 3 is odd, we multiply by 3 and add 1 giving us 10. 10 is even so we divide it by 2, giving us 5. 5 is odd so we multiply by 3 and add one, giving us 16. we divide 16 (even) by two giving 8. we divide 8 (even) by two giving 4. we divide 4 (even) by two giving 2. we divide 2 (even) by 2 to give us 1. once we have one, we stop. this example took seven operations to get to one. the largest number we had along the way was 16. every value of n that anyone has ever checked eventually leads to 1, but it is an open mathematical problem (known as the collatz conjectureopens in new tab) whether every value of n eventually leads to 1. your program should include a while loop and an if-statement.
Answers: 3
image
Computers and Technology, 24.06.2019 17:50, connorwbrown07
Acontact list is a place where you can store a specific contact with other associated information such as a phone number, email address, birthday, etc. write a program that first takes in word pairs that consist of a name and a phone number (both strings). that list is followed by a name, and your program should output that name's phone number.
Answers: 1
Do you know the correct answer?
1. the program should have the following specifications:
a. declare variables x, y and z with...

Questions in other subjects:

Konu
Mathematics, 06.09.2019 05:10
Konu
Mathematics, 06.09.2019 05:10