Java Term Work
JAVA TERM WORK
Course: Java Programming
Branch: Computer Science
Semester: ___
Student Name: __________
Roll No: __________
Institute: __________
1. INTRODUCTION
Java is a high-level, object-oriented programming language widely used for
developing desktop, web, and enterprise applications. It follows the principle of
“Write Once, Run Anywhere” (WORA).
This term work focuses on developing real-world applications using core Java
concepts such as:
• Classes and Objects
• Control Statements
• Loops
• Arrays
• Functions (Methods)
• User Input Handling
2. OBJECTIVES
• To understand Java programming fundamentals
• To apply logic building techniques
• To develop mini real-life applications
• To improve debugging and testing skills
• To understand modular programming
3. SOFTWARE REQUIREMENTS
• JDK (Java Development Kit)
• IDE (Eclipse / NetBeans / IntelliJ) or Command Prompt
• Operating System: Windows/Linux
4. PROJECTS
PROJECT 1: SIMPLE CALCULATOR APPLICATION (ADVANCED)
Aim
To design a menu-driven calculator using methods.
Features
• Supports multiple operations
• Uses functions for modularity
• Handles division by zero
Algorithm
1. Start
2. Display menu
3. Take user choice
4. Call respective function
5. Display result
6. Repeat until exit
Java Program
import [Link];
class CalculatorApp {
static double add(double a, double b) {
return a + b;
}
static double subtract(double a, double b) {
return a - b;
}
static double multiply(double a, double b) {
return a * b;
}
static double divide(double a, double b) {
if(b == 0) {
[Link]("Cannot divide by zero!");
return 0;
}
return a / b;
}
public static void main(String[] args) {
Scanner sc = new Scanner([Link]);
int choice;
do {
[Link]("\n--- Calculator Menu ---");
[Link]("1. Add\n2. Subtract\n3. Multiply\n4. Divide\n5.
Exit");
[Link]("Enter choice: ");
choice = [Link]();
if(choice >= 1 && choice <= 4) {
[Link]("Enter two numbers: ");
double a = [Link]();
double b = [Link]();
switch(choice) {
case 1: [Link]("Result: " + add(a,b)); break;
case 2: [Link]("Result: " + subtract(a,b)); break;
case 3: [Link]("Result: " + multiply(a,b)); break;
case 4: [Link]("Result: " + divide(a,b)); break;
}
}
} while(choice != 5);
[Link]("Program Ended.");
}
}
PROJECT 2: ATTENDANCE MANAGEMENT SYSTEM (ARRAY BASED)
Aim
To manage and analyze student attendance.
Features
• Stores attendance in array
• Calculates percentage
• Displays report
Algorithm
1. Input number of students
2. Store attendance
3. Count present students
4. Calculate percentage
5. Display report
Java Program
import [Link];
public class AttendanceSystem {
public static void main(String[] args) {
Scanner sc = new Scanner([Link]);
[Link]("Enter number of students: ");
int n = [Link]();
char[] attendance = new char[n];
int present = 0;
for(int i = 0; i < n; i++) {
[Link]("Student " + (i+1) + " (P/A): ");
attendance[i] = [Link]().charAt(0);
if(attendance[i] == 'P' || attendance[i] == 'p') {
present++;
}
}
double percentage = (present * 100.0) / n;
[Link]("\n--- Attendance Report ---");
[Link]("Total Students: " + n);
[Link]("Present: " + present);
[Link]("Absent: " + (n - present));
[Link]("Attendance %: " + percentage);
}
}
PROJECT 3: LIBRARY MANAGEMENT SYSTEM (WITH MENU)
Aim
To manage book issuing and returning system.
Features
• Issue book
• Return book
• View records
Java Program
import [Link];
class LibrarySystem {
static String book = "Java Programming";
static boolean isIssued = false;
static void issueBook(String student) {
if(!isIssued) {
isIssued = true;
[Link]("Book issued to " + student);
} else {
[Link]("Book already issued!");
}
}
static void returnBook() {
if(isIssued) {
isIssued = false;
[Link]("Book returned successfully.");
} else {
[Link]("No book issued.");
}
}
public static void main(String[] args) {
Scanner sc = new Scanner([Link]);
int choice;
do {
[Link]("\n1. Issue Book\n2. Return Book\n3. Exit");
[Link]("Enter choice: ");
choice = [Link]();
switch(choice) {
case 1:
[Link]();
[Link]("Enter student name: ");
String name = [Link]();
issueBook(name);
break;
case 2:
returnBook();
break;
}
} while(choice != 3);
}
}
PROJECT 4: TRAVEL TICKET BOOKING SYSTEM (ENHANCED)
Aim
To simulate ticket booking with fare calculation.
Features
• Different destinations
• Dynamic fare calculation
• Multiple passengers
Java Program
import [Link];
public class TravelBooking {
public static void main(String[] args) {
Scanner sc = new Scanner([Link]);
String[] destinations = {"Delhi", "Mumbai", "Kolkata"};
int[] fares = {300, 500, 400};
[Link]("Available Destinations:");
for(int i = 0; i < [Link]; i++) {
[Link]((i+1) + ". " + destinations[i] + " - Rs." + fares[i]);
}
[Link]("Choose destination: ");
int choice = [Link]();
[Link]("Enter number of tickets: ");
int tickets = [Link]();
int total = fares[choice-1] * tickets;
[Link]("\n--- Booking Details ---");
[Link]("Destination: " + destinations[choice-1]);
[Link]("Tickets: " + tickets);
[Link]("Total Fare: Rs." + total);
}
}
PROJECT 5: MEDICAL SHOP STOCK MANAGEMENT (ARRAY + MENU)
Aim
To manage medicine stock efficiently.
Features
• Add stock
• View stock
• Search medicine
Java Program
import [Link];
public class MedicalShop {
public static void main(String[] args) {
Scanner sc = new Scanner([Link]);
String[] meds = new String[5];
int[] qty = new int[5];
int count = 0;
int choice;
do {
[Link]("\n1. Add Medicine\n2. View Stock\n3. Exit");
[Link]("Enter choice: ");
choice = [Link]();
switch(choice) {
case 1:
[Link]();
[Link]("Enter medicine name: ");
meds[count] = [Link]();
[Link]("Enter quantity: ");
qty[count] = [Link]();
count++;
break;
case 2:
[Link]("\n--- Stock List ---");
for(int i = 0; i < count; i++) {
[Link](meds[i] + " - " + qty[i]);
}
break;
}
} while(choice != 3);
}
}
5. ADVANTAGES OF PROJECTS
• Improves logical thinking
• Helps understand real-world systems
• Enhances programming confidence
• Builds foundation for advanced Java
6. LIMITATIONS
• No database used (data is temporary)
• Console-based interface only
• Limited scalability
7. FUTURE ENHANCEMENT
• Add database (MySQL)
• Develop GUI using Swing/JavaFX
• Add login system
• Use file handling
8. CONCLUSION
This term work helped in understanding Java programming practically by
developing real-life applications. It strengthened concepts of control structures,
arrays, and object-oriented programming.