You are on page 1of 4

Programming Challenge

1. Write a Java program to print 'Hello' on screen and then print your name on
a separate line.

2. Write a Java program to print the result of the following operations.


Test Data:
a. -5 + 8 * 6
b. (55+9) % 9
c. 20 + -3*5 / 8
d. 5 + 15 / 3 * 2 - 8 % 3
Expected Output :
43
1
19
13
3. Create a Java Program using
1.Create a byte variable and set it to any valid byte number.
2. Create a short variable and set it to any valid short number.
3. Create aintvariable and set it to any valid in number.
4. Create a variable of type long, and make it equal to 50000 + 10 times the sum of the
byte, plus the short plus the int.
5. Create a variable of type short, and make it equal to 1000 + 10 times the sum of the
byte, plus the short plus the int.
4. Convert a given number of pounds to kilograms
1. Create a variable to store the number of pounds
2. Calculate the number of Kilograms for the number above and store in a variable.
3. Print out the result.

NOTES: 1 pound is equal to 0.45359237 kilograms.

5. Create a Java Program using


 Find the code for the registered symbol on the same line as the copyright symbol.
 Create a variable of type char and assign it the Unicode value for that symbol.
 Display in on screen.

6. Create a Java Program with the following steps


1. Create a Double variable with a value of 20.00.
2. Create a second variable of type double with the value of 80.00.
3. Add both numbers together and multiply by 100.00
4. Use the remainder operator to figure out what the remainder from the result of
the operation in step 3 and 40.00.
5. Create a Boolean variable that assigns the value true if the remainder in step 4 is
0 or false if it’snot zero.
6. Output the Boolean variable.
7. Write an if-then statement that displays a message “Got some remainder” if the
Boolean in step 5 is not true.

You might also like