0% found this document useful (0 votes)
4 views4 pages

Story Based Java Coding Worksheet - Medium Level

This document is a Java coding worksheet designed for medium-level learners, featuring story-based coding questions that cover a complete syllabus. It includes 15 coding problems that require the use of Java concepts such as object-oriented programming, arrays, and control statements, all framed within real-life scenarios. The worksheet is editable and aims to enhance practical coding skills through various applications like a restaurant billing system, university admissions, and a smart home system.

Uploaded by

parnikadesk
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views4 pages

Story Based Java Coding Worksheet - Medium Level

This document is a Java coding worksheet designed for medium-level learners, featuring story-based coding questions that cover a complete syllabus. It includes 15 coding problems that require the use of Java concepts such as object-oriented programming, arrays, and control statements, all framed within real-life scenarios. The worksheet is editable and aims to enhance practical coding skills through various applications like a restaurant billing system, university admissions, and a smart home system.

Uploaded by

parnikadesk
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Story Based Java Coding Worksheet – Medium

Level
(Coding Questions Only | Story-Based | Covers Complete Syllabus | Editable)

Instructions
• Solve all problems using Java
• Each question is based on a real-life story
• Difficulty level: Medium (logic + OOP usage)
• Use Scanner or Command Line Arguments as required

1. Java Basics + JVM + Garbage Collection

Q1. Startup App Story

A startup application creates thousands of temporary user session objects during peak hours. Write a Java
program that: - Creates objects inside a loop - Makes them eligible for Garbage Collection - Uses
comments to explain object lifecycle

2. Data Types, Identifiers & Operators

Q2. Restaurant Billing System

A restaurant stores: - Total number of items ordered - Price per item - GST percentage

Write a program to: - Calculate total bill - Apply GST - Compare bill amount with a budget using relational
operators

3. Decision Making Statements

Q3. University Admission Story

Admission rules: - Marks ≥ 85 and entrance test passed → Admission Confirmed - Marks ≥ 70 and
entrance test passed → Waiting List - Otherwise → Rejected

Write a Java program using nested if-else to display admission status.

1
4. Loop Constructs (Non-Trivial Logic)

Q4. Factory Machine Story

A factory machine produces items every hour. Some hours produce defective items. Write a program that: -
Runs for N hours - Skips defective hours using continue - Counts total valid items produced

5. Command Line Arguments

Q5. Online Cab Booking Story

Cab fare is calculated using: - Distance (km) - Cost per km - Surge multiplier

Accept all values using command line arguments and display final fare.

6. 1D Arrays

Q6. Employee Performance Story

An HR system stores monthly performance scores of employees. Write a program to: - Store scores in a 1D
array - Find highest and lowest score - Count employees scoring above average

7. 2D Arrays

Q7. School Exam Analysis Story

A school stores marks of students across multiple subjects. Write a program to: - Store data in a 2D array -
Calculate total marks per student - Identify the topper

8. Multidimensional Arrays

Q8. Company Sales Story

A company tracks sales for: - Multiple branches - Multiple products - Multiple months

Store data using a multidimensional array and calculate branch-wise total sales.

2
9. Jagged Arrays

Q9. Movie Theatre Story

A theatre has multiple screens with different numbers of seats. Write a Java program using a jagged array
to: - Store seat availability - Display total seats per screen

10. Classes & Objects (Access Control)

Q10. Digital Wallet Story

Create a Wallet class with: - Private balance variable - Methods to add money, spend money, and view
balance

Ensure balance cannot be accessed directly.

11. Constructors & Method Overloading

Q11. Online Course Platform Story

Create a Course class where: - Constructors initialize course name and duration - Overloaded methods
calculate course fee with and without discount

12. this & static Keyword

Q12. Company Payroll Story

Create an Employee class where: - Company name is shared (static) - this keyword is used inside
constructor - Display complete employee details

13. Inheritance & Method Overriding

Q13. Online Payment Story

Create a base class Payment and derived classes CardPayment and UPIPayment . Override payment
processing method and demonstrate dynamic method dispatch.

3
14. super & final Keyword

Q14. Banking Security Story

Create a base class BankRules with a final method for security checks. Use super to call parent
constructor and show that final method cannot be overridden.

15. Abstract Class & Interface

Q15. Smart Home System Story

Design a system where: - An abstract class Appliance defines common behavior - An interface
SmartControl defines control actions - Classes like Fan and Light extend and implement them

✅ End of Worksheet

✔ Story-Based ✔ Medium Difficulty ✔ Full Syllabus Coverage ✔ Editable & Exam-Oriented

You might also like