JAVA-Daily-Tasks

Day 03 - Real-World Conditions

πŸ“Œ Introduction

Day 03 focuses on applying Java conditional statements to real-world problems.

In this day, practical scenarios such as ATM withdrawal, e-commerce delivery, water usage, ticket pricing, salary bonus, shopping discounts, parking fees, and mobile recharge plans are implemented using Java.

The main goal is to improve logical thinking and understand how conditional statements are used in real-world applications.


🎯 Topics Covered


πŸ“ Folder Structure

Day-03-Real-World-Conditions/
β”‚
β”œβ”€β”€ README.md
β”‚
β”œβ”€β”€ Questions/
β”‚   └── Questions.txt
β”‚
β”œβ”€β”€ Solutions/
β”‚   β”œβ”€β”€ Q01_ATM_Withdrawal.java
β”‚   β”œβ”€β”€ Q02_ECommerce_Delivery.java
β”‚   β”œβ”€β”€ Q03_Water_Usage_Charge.java
β”‚   β”œβ”€β”€ Q04_Water_Park_Ticket.java
β”‚   β”œβ”€β”€ Q05_Simple_Interest.java
β”‚   β”œβ”€β”€ Q06_Movie_Ticket.java
β”‚   β”œβ”€β”€ Q07_Employee_Bonus.java
β”‚   β”œβ”€β”€ Q08_Shopping_Discount.java
β”‚   β”œβ”€β”€ Q09_Parking_Fee.java
β”‚   └── Q10_Mobile_Recharge.java
β”‚
└── Screenshots/
    β”œβ”€β”€ Q01_ATM_Withdrawal.png
    β”œβ”€β”€ Q02_ECommerce_Delivery.png
    β”œβ”€β”€ Q03_Water_Usage_Charge.png
    β”œβ”€β”€ Q04_Water_Park_Ticket.png
    β”œβ”€β”€ Q05_Simple_Interest.png
    β”œβ”€β”€ Q06_Movie_Ticket.png
    β”œβ”€β”€ Q07_Employee_Bonus.png
    β”œβ”€β”€ Q08_Shopping_Discount.png
    β”œβ”€β”€ Q09_Parking_Fee.png
    └── Q10_Mobile_Recharge.png

πŸ“ Practice Questions

Q01 - ATM Withdrawal

Get the account balance and withdrawal amount from the user.

Conditions:

Display:


Q02 - E-Commerce Delivery Charge

Get the order amount from the user.

Conditions:

Display the order amount, delivery charge, and final amount.


Q03 - Water Usage Charge

Get the number of water units used.

Conditions:

Calculate and display the total water bill.


Q04 - Water Park Ticket

Get the age of the customer.

Conditions:

Display the ticket price.


Q05 - Simple Interest

Get the principal amount, time in years, and customer type.

Customer types:

Interest rates:

Formula:

Simple Interest = (Principal Γ— Rate Γ— Time) / 100

Display the simple interest and total amount.


Q06 - Movie Ticket Price

Get the customer’s age and show type.

Age conditions:

Base ticket price:

If the show type is IMAX, add Rs.100.

Display the final ticket price.


Q07 - Employee Bonus

Get the employee salary and years of experience.

Conditions:

Display:


Q08 - Shopping Discount

Get the shopping amount and customer membership type.

Membership types:

Discount rules:

Membership Amount β‰₯ Rs.5000 Otherwise
Premium 25% 20%
Regular 15% 10%
Non-Member 5% No Discount

Display the discount and final amount.


Q09 - Parking Fee

Get the number of hours a vehicle is parked.

Conditions:

Calculate and display the total parking fee.


Q10 - Mobile Recharge Plan

Get the recharge amount.

Conditions:

Display the selected recharge plan.


πŸ’» Solutions

Question Description File
Q01 Checks whether the user can withdraw money while maintaining the required minimum account balance Q01_ATM_Withdrawal.java
Q02 Calculates the delivery charge based on the order amount and displays the final amount Q02_ECommerce_Delivery.java
Q03 Calculates the water bill based on the number of units consumed Q03_Water_Usage_Charge.java
Q04 Calculates the ticket price based on the customer’s age Q04_Water_Park_Ticket.java
Q05 Calculates simple interest using different interest rates for student and general customers Q05_Simple_Interest.java
Q06 Calculates the movie ticket price based on age and show type Q06_Movie_Ticket.java
Q07 Calculates the employee bonus based on years of experience Q07_Employee_Bonus.java
Q08 Calculates the shopping discount based on the purchase amount and membership type Q08_Shopping_Discount.java
Q09 Calculates the parking fee based on the number of hours the vehicle is parked Q09_Parking_Fee.java
Q10 Displays the appropriate mobile recharge plan based on the recharge amount Q10_Mobile_Recharge.java

πŸ› οΈ Technologies Used


▢️ How to Run

Step 1 – Open the Project

Open the Day-03-Real-World-Conditions folder in VS Code, Eclipse, or another Java-supported IDE.

Step 2 – Open the Solutions Folder

Navigate to:

Day-03-Real-World-Conditions/Solutions/

Step 3 – Compile a Java Program

Example:

javac Q01_ATM_Withdrawal.java

Step 4 – Run the Program

java Q01_ATM_Withdrawal

For other programs, replace the filename and class name with the required solution.


πŸ“Έ Screenshots

Screenshots of the program outputs can be added to the Screenshots/ folder.

Screenshots/
β”œβ”€β”€ Q01_ATM_Withdrawal.png
β”œβ”€β”€ Q02_ECommerce_Delivery.png
β”œβ”€β”€ Q03_Water_Usage_Charge.png
β”œβ”€β”€ Q04_Water_Park_Ticket.png
β”œβ”€β”€ Q05_Simple_Interest.png
β”œβ”€β”€ Q06_Movie_Ticket.png
β”œβ”€β”€ Q07_Employee_Bonus.png
β”œβ”€β”€ Q08_Shopping_Discount.png
β”œβ”€β”€ Q09_Parking_Fee.png
└── Q10_Mobile_Recharge.png

🎯 Learning Goals

By completing Day 03, you will:


πŸ“Œ Status

Day 03 – Completed