1) Identify Project Scope and Objective of Given Problem: A. College Automation System. B. Banking Management System. College Automation System
1) Identify Project Scope and Objective of Given Problem: A. College Automation System. B. Banking Management System. College Automation System
Project Scope:
The College Automation System aims to automate various administrative and academic
functions of a college, such as student registration, attendance management, course
management, and exam results. The system streamlines processes to improve efficiency and
accuracy.
Objectives:
class Student:
self.roll_no = roll_no
self.name = name
self.course = course
self.attendance = 0
def mark_attendance(self):
self.attendance += 1
def display_details(self):
class College:
def __init__(self):
self.students = {}
def add_student(self):
if roll_no in self.students:
return
self.students[roll_no] = student
if roll_no in self.students:
self.students[roll_no].mark_attendance()
else:
def display_all_students(self):
print("\nList of Students:")
student.display_details()
# Driver Code
college = College()
while True:
print("\nMenu:")
print("4. Exit")
if choice == 1:
college.add_student()
elif choice == 2:
college.mark_attendance()
elif choice == 3:
college.display_all_students()
elif choice == 4:
print("Exiting...")
break
else:
Code Explanation
def mark_attendance(self):
self.attendance += 1 # Increment attendance by 1
Purpose: This method is called whenever attendance needs to be marked for the
student.
def display_details(self):
print(f"Roll No: {self.roll_no}, Name: {self.name}, Course: {self.course}, Attendance:
{self.attendance} days")
Purpose: The College class acts as a manager for all students. It contains methods to
add students, mark attendance, and display all students.
self.students is a dictionary where:
o Key: roll_no of the student.
o Value: Student object.
def add_student(self):
roll_no = int(input("Enter Roll No: ")) # Input roll number from the user
if roll_no in self.students:
print("Student with this Roll No already exists!") # Prevent duplicate roll numbers
return
name = input("Enter Name: ") # Input name
course = input("Enter Course: ") # Input course
student = Student(roll_no, name, course) # Create a Student object
self.students[roll_no] = student # Add student to the dictionary
print(f"Student {name} added successfully.")
def display_all_students(self):
print("\nList of Students:")
for student in self.students.values(): # Iterate through all Student objects in the
dictionary
student.display_details() # Call the `display_details()` method of each student
Driver Code
college = College() # Create an instance of the College class
Purpose: Initializes the College object where students will be stored and managed.
while True:
print("\nMenu:")
print("1. Add Student")
print("2. Mark Attendance")
print("3. Display All Students")
print("4. Exit")
choice = int(input("Enter your choice: "))
Purpose: Displays a menu and allows the user to perform different actions (add
students, mark attendance, display students, or exit).
if choice == 1:
college.add_student() # Calls the method to add a student
elif choice == 2:
college.mark_attendance() # Calls the method to mark attendance
elif choice == 3:
college.display_all_students() # Calls the method to display all students
elif choice == 4:
print("Exiting...")
break # Exit the loop and program
else:
print("Invalid choice! Please try again.")
Purpose:
o Based on the user's choice:
1: Adds a student.
2: Marks attendance for a student.
3: Displays all students.
4: Exits the program.
o Handles invalid input by displaying an error message.
class BankAccount:
def __init__(self, account_no, name, balance=0):
self.account_no = account_no
self.name = name
self.balance = balance
def deposit(self):
amount = float(input("Enter amount to deposit: "))
self.balance += amount
print(f"{amount} deposited successfully. New Balance: {self.balance}")
def withdraw(self):
amount = float(input("Enter amount to withdraw: "))
if amount > self.balance:
print("Insufficient balance!")
else:
self.balance -= amount
print(f"{amount} withdrawn successfully. Remaining Balance: {self.balance}")
def display_details(self):
print(f"Account No: {self.account_no}, Name: {self.name}, Balance: {self.balance}")
class BankingSystem:
def __init__(self):
self.accounts = {}
def create_account(self):
account_no = int(input("Enter Account Number: "))
if account_no in self.accounts:
print("Account with this number already exists!")
return
name = input("Enter Account Holder's Name: ")
initial_balance = float(input("Enter Initial Balance: "))
account = BankAccount(account_no, name, initial_balance)
self.accounts[account_no] = account
print(f"Account for {name} created successfully.")
def access_account(self):
account_no = int(input("Enter Account Number: "))
if account_no in self.accounts:
account = self.accounts[account_no]
while True:
print("\nAccount Menu:")
print("1. Deposit")
print("2. Withdraw")
print("3. Display Account Details")
print("4. Exit")
choice = int(input("Enter your choice: "))
if choice == 1:
account.deposit()
elif choice == 2:
account.withdraw()
elif choice == 3:
account.display_details()
elif choice == 4:
break
else:
print("Invalid choice! Please try again.")
else:
print("Account not found!")
# Driver Code
banking_system = BankingSystem()
while True:
print("\nMain Menu:")
print("1. Create Account")
print("2. Access Account")
print("3. Exit")
choice = int(input("Enter your choice: "))
if choice == 1:
banking_system.create_account()
elif choice == 2:
banking_system.access_account()
elif choice == 3:
print("Exiting...")
break
else:
print("Invalid choice! Please try again.")