EX.
NO: MINI PROJECT- COURSE REGISTRATION
DATE:
AIM :
To develop a Java program that allows students to register for a course by providing their
details, selecting a course from available options, and displaying a registration summary,
including the fee structure.
ALGORITHM :
1. Start the pogram
2. Create a Scanner object to read user input.
3. Display a welcome message for the course registration system.
4. Prompt the user to input their details:
○ Name
○ Address
○ Contact number
○ Email
○ Marks in Maths, Physics, and Chemistry
5. Display the available course options with corresponding fees.
6. Ask the user to select a course by entering a number between 1 and 4.
7. Map the selected course to its name and fee structure:
○ If the choice is invalid, display an error message and exit the program.
8. Display the registration summary:
○ User details
○ Selected course
○ Fee structure
○ Available seats
9. Check if all required fields are filled correctly: ○ If valid, display a success message.
○ Otherwise, prompt the user to fill in the missing fields.
10. Close the Scanner.
11. Stop.
Program :
import java.util.Scanner; public class
CourseRegistration { public static void main(String[]
args) {
// Create a Scanner object for reading input
Scanner scanner = new Scanner(System.in);
// Display a welcome message
System.out.println("Welcome to Course Registration");
// Collecting user information through the console
System.out.print("Enter your name: ");
String name = scanner.nextLine();
System.out.print("Enter your address: ");
String address = scanner.nextLine();
System.out.print("Enter your contact number: ");
String number = scanner.nextLine();
System.out.print("Enter your email: ");
String email = scanner.nextLine();
System.out.print("Enter marks in Maths: ");
String maths = scanner.nextLine();
System.out.print("Enter marks in Physics: ");
String physics = scanner.nextLine();
System.out.print("Enter marks in Chemistry: ");
String chemistry = scanner.nextLine();
// Display available courses
System.out.println("Choose a course from the following options:");
System.out.println("1. B.Tech - $1500 per semester");
System.out.println("2. M.Tech - $2000 per semester");
System.out.println("3. MBA - $2500 per semester");
System.out.println("4. MCA - $1800 per semester");
System.out.print("Enter the number of your choice (1-4): "); int courseChoice =
scanner.nextInt(); scanner.nextLine(); // Consume the newline
// Map the course choice to actual course name and fee String course = "";
double fee = 0.0; switch (courseChoice) { case 1:
course = "B.Tech"; fee =
1500.0; break; case 2:
course = "M.Tech"; fee =
2000.0; break; case 3:
course = "MBA"; fee
= 2500.0; break; case 4:
course = "MCA"; fee
= 1800.0; break; default:
System.out.println("Invalid choice. Please select a number between 1 and 4.");
return; // Exit the program if the input is invalid
}
// Set initial available seats int
availableSeats = 100;
// Output the registration details
System.out.println("\nRegistration Summary:");
System.out.println("Name: " + name);
System.out.println("Address: " + address);
System.out.println("Number: " + number);
System.out.println("Email: " + email);
System.out.println("Marks in Maths: " + maths);
System.out.println("Marks in Physics: " + physics);
System.out.println("Marks in Chemistry: " + chemistry);
System.out.println("Course: " + course);
System.out.println("Fee: $" + fee + " per semester");
System.out.println("Available Seats: " + availableSeats);
// Check if all fields are filled in
if (!name.isEmpty() && !address.isEmpty() && !number.isEmpty()
&& !email.isEmpty() &&
!maths.isEmpty() && !physics.isEmpty() &&
!chemistry.isEmpty() && courseChoice >= 1 && courseChoice <= 4) {
// Registration success
System.out.println("\nRegistration successful!");
} else {
// Missing fields
System.out.println("\nPlease fill in all fields correctly.");
}
// Close the scanner scanner.close();
}
}
Output :
Welcome to Course Registration
Enter your name: John Doe
Enter your address: 123 Elm Street
Enter your contact number: 9876543210
Enter marks in Maths: 85
Enter marks in Physics: 78
Enter marks in Chemistry: 90
Choose a course from the following options:
1. B.Tech - $1500 per semester
2. M.Tech - $2000 per semester
3. MBA - $2500 per semester
4. MCA - $1800 per semester
Enter the number of your choice (1-4): 1
Registration Summary:
Name: John Doe
Address: 123 Elm Street
Number: 9876543210
Email: [email protected]
Marks in Maths: 85
Marks in Physics: 78
Marks in Chemistry: 90
Course: B.Tech
Fee: $1500.0 per semester
Available Seats: 100
Registration successful!
APPLICATIONS:
1. Educational Institution
2. Corporate training programs
3. Online platform
4. Entrance preparation classes.
RESULT:
The program successfully collects user details, validates input, displays course options with
fees, and outputs a summary of the registration, confirming successful enrollment for a selected
course.