Java Excersize
Java Excersize
Java Excersize
*****
*****
*****
*****
Hello Dara!
JAVA ARITHMETIC OPERATORS
Exercise 1: Write Java program to allow the user to input two
integer values and then the program prints the results of
adding, subtracting, multiplying, and dividing among the two
values.
See the example below:
To generate a random number, you can use the Random class of java.util
package. You may use the abs() method of Math class to make sure you can
Exercise 1: Write Java program to allow the user to input two float values and
then the program adds the two values together. The result will be assigned to
Exercise 2: Write Java program to allow the user to input the amount of
Exercise 1: Write Java program to allow the user to input his/her age. Then
the program will show if the person is eligible to vote. A person who is eligible
even number.
Quiz score: 80
Mid-term score: 68
Final score: 90
Your grade is B.
SWITCH CASE
a. int 1x=10;
b. int x=10;
c. float x=10.0f;
d. string x="10";
Enter your choice: b
Congratulations!
LOOPS IN JAVA
Exercise 1: Write a Java program by using two for loops to
produce the output shown below:
*******
******
*****
****
***
**
1******
12*****
123****
1234***
12345**
123456*
1234567
WHILE LOOP
Exercise 1: Write Java program to prompt the user to choose
the correct answer from a list of answer choices of a
question.
The user can choose to continue answering the question or stop answering it.
See the example below:
a. int
b. continue
c. break
d. exit
Incorrect!
Congratulations!
a. int
b. continue
c. break
d. exit
Enter your choice: b
Incorrect!
Congratulations!