JAVA BASICS CHALLENGE LEVEL 1
1. Calculate Student Total Marks
Write a program that reads the marks obtained in three subjects and prints the
total marks.
Sample 1:
Input → 75 82 91
Output → Total Marks = 248
Sample 2:
Input → 60 70 80
Output → Total Marks = 210
2. Calculate Bus Ticket Cost
Write a program that reads the number of passengers and the ticket fare per
passenger. Print the total ticket cost.
Sample 1:
Input → 4 120
Output → Total Cost = 480
Sample 2:
Input → 2 350
Output → Total Cost = 700
3. Find Cube of a Number
Write a program that takes an integer as input and prints its cube.
Sample 1:
Input → 3
Output → Cube = 27
Sample 2:
Input → 5
Output → Cube = 125
4. Calculate Rectangle Perimeter
Write a program that reads the length and breadth of a rectangle and prints its
perimeter.
Formula: Perimeter = 2 × (Length + Breadth)
Sample 1:
Input → 8 5
Output → Perimeter = 26
Sample 2:
Input → 12 4
Output → Perimeter = 32
5. Convert Minutes to Seconds
Write a program to convert minutes into seconds.
Sample 1:
Input → 5
Output → 300 seconds
Sample 2:
Input → 12
Output → 720 seconds
6. Calculate Simple Interest
Write a program that calculates Simple Interest.
Formula: SI = (Principal × Rate × Time) / 100
Sample 1:
Input → 10000 8 2
Output → Simple Interest = 1600.0
Sample 2:
Input → 5000 10 3
Output → Simple Interest = 1500.0
7. Calculate Monthly Salary
Write a program that reads the daily wage and the number of working days,
then prints the monthly salary.
Sample 1:
Input → 800 25
Output → Monthly Salary = 20000
Sample 2:
Input → 650 26
Output → Monthly Salary = 16900
8. Convert Hours to Minutes
Write a program to convert hours into minutes.
Sample 1:
Input → 3
Output → 180 minutes
Sample 2:
Input → 7
Output → 420 minutes
9. Calculate Discount Amount
Write a program that reads the original price and the discount percentage.
Print the discount amount.
Formula: Discount = (Price × Discount Percentage) / 100
Sample 1:
Input → 2000 10
Output → Discount = 200.0
Sample 2:
Input → 1500 15
Output → Discount = 225.0
10. Swap Two Numbers
Write a program that reads two integers and swaps their values using a
temporary variable.
Sample 1:
Input → 10 20
Output → After Swapping
First Number = 20
Second Number = 10
Sample 2:
Input → 5 15
Output → After Swapping
First Number = 15
Second Number = 5