You are on page 1of 4

Bachelor of Science in Information Technology

IT 112 – Computer Programming 1


Project Set 5
Arithmetic operators
1. Create a Java program to convert US dollar ($) into Philippine Peso.
Assume that one US dollar is equivalent to 50.74 pesos then display the
result on the screen.

2. Create a java program that will reverses the character based on the user
input.

Expected Output:

Enter string 1: U
Enter string 2: O
Enter string 3: Y
Enter string 4: E
Enter string 5: V
Enter string 6: O
Enter string 7: L
Enter string 8: I
===========================
The reverse word is: ILOVEYOU
===========================
3. Create a java program to compute the gross pay of a worker name James
Weird that James Weird worked for 60 hours at the rate of 122.20 per
hour. The program will display the name of employee and the computed
gross pay of the employee.

4. Create a Java program that will display the following output on the
screen.

5. Create a java program that will display the following output on the
screen
If else statement
6. Create a Java program using if statement that will mimics a login form
where user enter username and password.

Note: Username is admin


Password is admin
Sample output:
Enter username: James
Enter password: admin
Incorrect password or username, please try again!
==============================================
Enter username: admin
Enter password: admin
Welcome to the System!

7. Create a program to allow the user to input students name and course,
the program will read three types of scores (QUIZ, MIDTERM and FINAL
SCORE) and determines the grade based on the following rules. (Using
statement)

CONDITIONS CORESPONDING GRADE


Average from 98 – 100 The Grade is 1.0
Average from 95 – 97 The Grade is 1.25
Average from 92 – 94 The Grade is 1.5
Average from 89 – 91 The Grade is 1.75
Average from 86 – 88 The Grade is 2.0
Average from 83 – 85 The Grade is 2.25
Average from 80 – 82 The Grade is 2.5
Average from 77 – 79 The Grade is 2.75
Average from 75 – 76 The Grade is 3.0
Average is lesser than 75 The grade is Failed

Formula in Getting the total average: Average = (quiz + midterm +


finalscore)/3

Sample Output:
Enter Name: Juan Dela Cruz
Enter Course: BSIT
=================================
Enter Prelim: 90
Enter Midterm: 87
Enter Final: 85
=================================
Juan Dela Cruz your final grade is 87.33
Your grade equivalent is 2.0

8. Write a Java program to calculate the revenue from a sale based on the
unit price and quantity of a product input by the user.
Formula:
Revenue = unitprice* quantity
Discount_amount = revenue*discountrate/100

QUANTITY PURCHASED DISCOUNT RATE


Purchased between 100 and 120 10%
Purchased less than 100 units 0%

See the example output as shown below:


Enter item: Youngstown Sardines
Enter unit price: 25
Enter quantity: 110
The revenue from sale is : 2750
After discount: 275.0(10.0%)

Select/switch statement

9. Create a Java program that will allow the user to input fruit types and
their classification based on the given table below.

Type of fruits Classification


Orange Citrus Fruit
Rambutan Tropical Fruit
Banana Winter Fruits
Watermelon Hydrating Fruits
Pineapple Seasonal Fruits
Other varieties Fruits not included

10. Create a Java program that will allow the user to input age of an
individual then determines its classification based on the following table.
Age Classification
0 Newborn
1 Infant
2-3 Toddler
4-5 Pre - School
6-12 School age
13 – 19 Teenager
For loop and Do While Loop
11. Create a program using for loop to display the following output.

+
+++
+++++
++++++++
++++++++++
++++++++
+++++
+++
+

12. Create a program using while loop to display the following output.

2 I love Java Programming


Programming is fun
4 I love Java Programming
Programming is fun
6 I love Java Programming
Programming is fun
8 I love Java Programming
Programming is fun
10 I love Java Programming
Programming is fun
12 I love Java Programming
Programming is fun
14 I love Java Programming
Programming is fun
16 I love Java Programming
Programming is fun
18 I love Java Programming
Programming is fun
20 I love Java Programming
Programming is fun

13. Create a program using for loop to get the sum and average of the
inputted value.

Sample output:
Enter first number: 0
Enter second number: 10
The sum of inputted number from 0 -10 is: 55
The average is: 5.5

You might also like