Project 1

 """

Name Of the Project : Vehicle Registration System
Author Name : Shome Nath Bhawani
Class : XII Section : Z
Session : 2020-21
Registration Number : 123456

"""
import pickle
import os

def create():
rec = []
with open("xyz.dat", "wb") as fp:
Registration_No=input("Enter Registration Number :")
Registration_Date=input("Enter Registration Date :")
Chassis_No=input("Enter Chassis Number :")
Engine_No=input("Enter Engine Number :")
Owner_Name=input("Enter Owner Name :")
Owner_Address=input("Enter Owner Address :")
Owner_Mobile_Number=input("Enter Owner Mobile Number :")
Dealer_Name=input("Enter Dealer Name :")
Dealer_Address=input("Enter Dealer Address :")
Dealer_Phone_Number=input("Enter Dealer Phone Number :")
Vehicle_Class=input("Enter Vehicle Class :")
Fuel_Type=input("Enter Fuel Type :")
Maker=input("Enter Maker of Vehicle:")
Model=input("Enter model of Vehicle:")
Type_of_body=input("Enter Type of body :")
Month_and_year_of_manufacture=input("Enter Month and year of manufacture :")
No_of_Cylinders=input("Enter Number of Cylinders :")
Horse_power=input("Enter Horse Power :")
Cubic_capacity=input("Enter Cubic capacity :")
Wheel_base=input("Enter Wheel base :")
Seating_capacity_including_driver=input("Enter Seating capacity including driver :")
Colour_of_body=input("Enter Colour of the Body :")
Unladen_weight=input("Enter Unladen Weight :")
Gross_vehicle_weight=input("Enter Gross Vehicleweight :")
Fitness_Upto=input("Enter Fitness Upto :")
Vechile_cost=input("Enter Cost of Vehicle:")
Road_Tax_Paid_Upto=input("Enter Road Tax Paid Upto :")
Registering_Authority=input("Enter Registration Authority :")
rec = [Registration_No, Registration_Date, Chassis_No, Engine_No, Owner_Name, Owner_Address, Owner_Mobile_Number,
Dealer_Name, Dealer_Address, Dealer_Phone_Number, Vehicle_Class, Fuel_Type, Maker, Model, Type_of_body,
Month_and_year_of_manufacture, No_of_Cylinders, Horse_power, Cubic_capacity, Wheel_base,
Seating_capacity_including_driver, Colour_of_body, Unladen_weight, Gross_vehicle_weight, Fitness_Upto,
Vechile_cost, Road_Tax_Paid_Upto, Registering_Authority]
pickle.dump(rec, fp)
fp.close()
menu()

def append():
rec = []
with open("xyz.dat", "ab") as fp:
Registration_No=input("Enter Registration Number :")
Registration_Date=input("Enter Registration Date :")
Chassis_No=input("Enter Chassis Number :")
Engine_No=input("Enter Engine Number :")
Owner_Name=input("Enter Owner Name :")
Owner_Address=input("Enter Owner Address :")
Owner_Mobile_Number=input("Enter Owner Mobile Number :")
Dealer_Name=input("Enter Dealer Name :")
Dealer_Address=input("Enter Dealer Address :")
Dealer_Phone_Number=input("Enter Dealer Phone Number :")
Vehicle_Class=input("Enter Vehicle Class :")
Fuel_Type=input("Enter Fuel Type :")
Maker = input("Enter Maker of Vehicle:")
Model = input("Enter model of Vehicle:")
Type_of_body=input("Enter Type of body :")
Month_and_year_of_manufacture=input("Enter Month and year of manufacture :")
No_of_Cylinders=input("Enter Number of Cylinders :")
Horse_power=input("Enter Horse Power :")
Cubic_capacity=input("Enter Cubic capacity :")
Wheel_base=input("Enter Wheel base :")
Seating_capacity_including_driver=input("Enter Seating capacity including driver :")
Colour_of_body=input("Enter Colour of the Body :")
Unladen_weight=input("Enter Unladen Weight :")
Gross_vehicle_weight=input("Enter Gross Vehicleweight :")
Fitness_Upto=input("Enter Fitness Upto :")
Vechile_cost=input("Enter Cost of Vehicle:")
Road_Tax_Paid_Upto=input("Enter Road Tax Paid Upto :")
Registering_Authority=input("Enter Registration Authority :")
rec = [Registration_No, Registration_Date, Chassis_No, Engine_No, Owner_Name, Owner_Address, Owner_Mobile_Number,
Dealer_Name, Dealer_Address, Dealer_Phone_Number, Vehicle_Class, Fuel_Type, Maker, Model, Type_of_body,
Month_and_year_of_manufacture, No_of_Cylinders, Horse_power, Cubic_capacity, Wheel_base,
Seating_capacity_including_driver, Colour_of_body, Unladen_weight, Gross_vehicle_weight, Fitness_Upto,
Vechile_cost, Road_Tax_Paid_Upto, Registering_Authority]
pickle.dump(rec, fp)
fp.close()
menu()


def dispall():
rec = []
with open("xyz.dat", "rb") as fp:
try:
while True:
line = pickle.load(fp)
rec = line
print("Registration Number : ", rec[0])
print("Registration Date : ", rec[1])
print("Chassis Number : ", rec[2])
print("Engine Number : ", rec[3])
print("Owner Name :", rec[4])
print("Owner Address : ", rec[5])
print("Owner Mobile Number : ", rec[6])
print("Dealer Name : ", rec[7])
print("Dealer Address : ", rec[8])
print("Dealer Phone Number : ", rec[9])
print("Vehicle Class : ", rec[10])
print("Fuel Type : ", rec[11])
print("Maker of Vehicle : ", rec[12])
print("Model of Vehicle : ", rec[13])
print("Type of body : ", rec[14])
print("Month and year of manufacture : ", rec[15])
print("Number of Cylinders : ", rec[16])
print("Horse Power : ", rec[17])
print("Cubic capacity : ", rec[18])
print("Wheel base : ", rec[19])
print("Seating capacity including driver : ", rec[20])
print("Colour of the Body : ", rec[21])
print("Unladen Weight : ", rec[22])
print("Gross Vehicle weight : ", rec[23])
print("Fitness Upto : ", rec[24])
print("Cost of Vehicle : ", rec[25])
print("Road Tax Paid Upto : ", rec[26])
print("Registration Authority : ", rec[27])
print("--------------------------------------------------------------------")
except EOFError:
fp.close()
menu()


def searchregno():
rec = []
regno = int(input("Enter the Registration Number to be searched"))
with open("xyz.dat", "rb") as fp:
try:
while True:
line = pickle.load(fp)
rec = line
if regno == rec[0]:
print("Registration Number : ", rec[0])
print("Registration Date : ", rec[1])
print("Chassis Number : ", rec[2])
print("Engine Number : ", rec[3])
print("Owner Name :", rec[4])
print("Owner Address : ", rec[5])
print("Owner Mobile Number : ", rec[6])
print("Dealer Name : ", rec[7])
print("Dealer Address : ", rec[8])
print("Dealer Phone Number : ", rec[9])
print("Vehicle Class : ", rec[10])
print("Fuel Type : ", rec[11])
print("Maker of Vehicle : ", rec[12])
print("Model of Vehicle : ", rec[13])
print("Type of body : ", rec[14])
print("Month and year of manufacture : ", rec[15])
print("Number of Cylinders : ", rec[16])
print("Horse Power : ", rec[17])
print("Cubic capacity : ", rec[18])
print("Wheel base : ", rec[19])
print("Seating capacity including driver : ", rec[20])
print("Colour of the Body : ", rec[21])
print("Unladen Weight : ", rec[22])
print("Gross Vehicle weight : ", rec[23])
print("Fitness Upto : ", rec[24])
print("Cost of Vehicle : ", rec[25])
print("Road Tax Paid Upto : ", rec[26])
print("Registration Authority : ", rec[27])
except EOFError:
fp.close()
menu()


def searchregdt():
rec = []
scregdt = input("Enter the Registration Number to be searched")
with open("xyz.dat", "rb") as fp:
try:
while True:
line = pickle.load(fp)
rec = line
if scregdt == rec[1]:
print("Registration Number : ", rec[0])
print("Registration Date : ", rec[1])
print("Chassis Number : ", rec[2])
print("Engine Number : ", rec[3])
print("Owner Name :", rec[4])
print("Owner Address : ", rec[5])
print("Owner Mobile Number : ", rec[6])
print("Dealer Name : ", rec[7])
print("Dealer Address : ", rec[8])
print("Dealer Phone Number : ", rec[9])
print("Vehicle Class : ", rec[10])
print("Fuel Type : ", rec[11])
print("Maker of Vehicle : ", rec[12])
print("Model of Vehicle : ", rec[13])
print("Type of body : ", rec[14])
print("Month and year of manufacture : ", rec[15])
print("Number of Cylinders : ", rec[16])
print("Horse Power : ", rec[17])
print("Cubic capacity : ", rec[18])
print("Wheel base : ", rec[19])
print("Seating capacity including driver : ", rec[20])
print("Colour of the Body : ", rec[21])
print("Unladen Weight : ", rec[22])
print("Gross Vehicle weight : ", rec[23])
print("Fitness Upto : ", rec[24])
print("Cost of Vehicle : ", rec[25])
print("Road Tax Paid Upto : ", rec[26])
print("Registration Authority : ", rec[27])
except EOFError:
fp.close()
menu()


def ownername():
rec = []
owname = input("Enter the Owner Name to be searched")
with open("xyz.dat", "rb") as fp:
try:
while True:
line = pickle.load(fp)
rec = line
if owname == rec[4]:
print("Registration Number : ", rec[0])
print("Registration Date : ", rec[1])
print("Chassis Number : ", rec[2])
print("Engine Number : ", rec[3])
print("Owner Name :", rec[4])
print("Owner Address : ", rec[5])
print("Owner Mobile Number : ", rec[6])
print("Dealer Name : ", rec[7])
print("Dealer Address : ", rec[8])
print("Dealer Phone Number : ", rec[9])
print("Vehicle Class : ", rec[10])
print("Fuel Type : ", rec[11])
print("Maker of Vehicle : ", rec[12])
print("Model of Vehicle : ", rec[13])
print("Type of body : ", rec[14])
print("Month and year of manufacture : ", rec[15])
print("Number of Cylinders : ", rec[16])
print("Horse Power : ", rec[17])
print("Cubic capacity : ", rec[18])
print("Wheel base : ", rec[19])
print("Seating capacity including driver : ", rec[20])
print("Colour of the Body : ", rec[21])
print("Unladen Weight : ", rec[22])
print("Gross Vehicle weight : ", rec[23])
print("Fitness Upto : ", rec[24])
print("Cost of Vehicle : ", rec[25])
print("Road Tax Paid Upto : ", rec[26])
print("Registration Authority : ", rec[27])
print("--------------------------------------------------------------------")
except EOFError:
fp.close()
menu()


def dealername():
rec = []
dename = input("Enter the Dealer Name to be searched")
with open("xyz.dat", "rb") as fp:
try:
while True:
line = pickle.load(fp)
rec = line
if dename == rec[7]:
print("Registration Number : ", rec[0])
print("Registration Date : ", rec[1])
print("Chassis Number : ", rec[2])
print("Engine Number : ", rec[3])
print("Owner Name :", rec[4])
print("Owner Address : ", rec[5])
print("Owner Mobile Number : ", rec[6])
print("Dealer Name : ", rec[7])
print("Dealer Address : ", rec[8])
print("Dealer Phone Number : ", rec[9])
print("Vehicle Class : ", rec[10])
print("Fuel Type : ", rec[11])
print("Maker of Vehicle : ", rec[12])
print("Model of Vehicle : ", rec[13])
print("Type of body : ", rec[14])
print("Month and year of manufacture : ", rec[15])
print("Number of Cylinders : ", rec[16])
print("Horse Power : ", rec[17])
print("Cubic capacity : ", rec[18])
print("Wheel base : ", rec[19])
print("Seating capacity including driver : ", rec[20])
print("Colour of the Body : ", rec[21])
print("Unladen Weight : ", rec[22])
print("Gross Vehicle weight : ", rec[23])
print("Fitness Upto : ", rec[24])
print("Cost of Vehicle : ", rec[25])
print("Road Tax Paid Upto : ", rec[26])
print("Registration Authority : ", rec[27])
except EOFError:
fp.close()
menu()


def fueltype():
rec = []
fltype = input("Enter the Fuel type to be searched")
with open("xyz.dat", "rb") as fp:
try:
while True:
line = pickle.load(fp)
rec = line
if fltype == rec[11]:
print("Registration Number : ", rec[0])
print("Registration Date : ", rec[1])
print("Chassis Number : ", rec[2])
print("Engine Number : ", rec[3])
print("Owner Name :", rec[4])
print("Owner Address : ", rec[5])
print("Owner Mobile Number : ", rec[6])
print("Dealer Name : ", rec[7])
print("Dealer Address : ", rec[8])
print("Dealer Phone Number : ", rec[9])
print("Vehicle Class : ", rec[10])
print("Fuel Type : ", rec[11])
print("Maker of Vehicle : ", rec[12])
print("Model of Vehicle : ", rec[13])
print("Type of body : ", rec[14])
print("Month and year of manufacture : ", rec[15])
print("Number of Cylinders : ", rec[16])
print("Horse Power : ", rec[17])
print("Cubic capacity : ", rec[18])
print("Wheel base : ", rec[19])
print("Seating capacity including driver : ", rec[20])
print("Colour of the Body : ", rec[21])
print("Unladen Weight : ", rec[22])
print("Gross Vehicle weight : ", rec[23])
print("Fitness Upto : ", rec[24])
print("Cost of Vehicle : ", rec[25])
print("Road Tax Paid Upto : ", rec[26])
print("Registration Authority : ", rec[27])
print("--------------------------------------------------------------------")
except EOFError:
fp.close()
menu()


def makername():
rec = []
mkname = input("Enter the Maker Name to be searched")
with open("xyz.dat", "rb") as fp:
try:
while True:
line = pickle.load(fp)
rec = line
if mkname == rec[12]:
print("Registration Number : ", rec[0])
print("Registration Date : ", rec[1])
print("Chassis Number : ", rec[2])
print("Engine Number : ", rec[3])
print("Owner Name :", rec[4])
print("Owner Address : ", rec[5])
print("Owner Mobile Number : ", rec[6])
print("Dealer Name : ", rec[7])
print("Dealer Address : ", rec[8])
print("Dealer Phone Number : ", rec[9])
print("Vehicle Class : ", rec[10])
print("Fuel Type : ", rec[11])
print("Maker of Vehicle : ", rec[12])
print("Model of Vehicle : ", rec[13])
print("Type of body : ", rec[14])
print("Month and year of manufacture : ", rec[15])
print("Number of Cylinders : ", rec[16])
print("Horse Power : ", rec[17])
print("Cubic capacity : ", rec[18])
print("Wheel base : ", rec[19])
print("Seating capacity including driver : ", rec[20])
print("Colour of the Body : ", rec[21])
print("Unladen Weight : ", rec[22])
print("Gross Vehicle weight : ", rec[23])
print("Fitness Upto : ", rec[24])
print("Cost of Vehicle : ", rec[25])
print("Road Tax Paid Upto : ", rec[26])
print("Registration Authority : ", rec[27])
print("--------------------------------------------------------------------")
except EOFError:
fp.close()
menu()


def modelname():
rec = []
mdname = input("Enter the Model Name to be searched")
with open("xyz.dat", "rb") as fp:
try:
while True:
line = pickle.load(fp)
rec = line
if mdname == rec[13]:
print("Registration Number : ", rec[0])
print("Registration Date : ", rec[1])
print("Chassis Number : ", rec[2])
print("Engine Number : ", rec[3])
print("Owner Name :", rec[4])
print("Owner Address : ", rec[5])
print("Owner Mobile Number : ", rec[6])
print("Dealer Name : ", rec[7])
print("Dealer Address : ", rec[8])
print("Dealer Phone Number : ", rec[9])
print("Vehicle Class : ", rec[10])
print("Fuel Type : ", rec[11])
print("Maker of Vehicle : ", rec[12])
print("Model of Vehicle : ", rec[13])
print("Type of body : ", rec[14])
print("Month and year of manufacture : ", rec[15])
print("Number of Cylinders : ", rec[16])
print("Horse Power : ", rec[17])
print("Cubic capacity : ", rec[18])
print("Wheel base : ", rec[19])
print("Seating capacity including driver : ", rec[20])
print("Colour of the Body : ", rec[21])
print("Unladen Weight : ", rec[22])
print("Gross Vehicle weight : ", rec[23])
print("Fitness Upto : ", rec[24])
print("Cost of Vehicle : ", rec[25])
print("Road Tax Paid Upto : ", rec[26])
print("Registration Authority : ", rec[27])
except EOFError:
fp.close()
menu()


def regauthor():
rec = []
rega = input("Enter the Class to be searched")
with open("xyz.dat", "rb") as fp:
try:
while True:
line = pickle.load(fp)
rec = line
if rega == rec[27]:
print("Registration Number : ", rec[0])
print("Registration Date : ", rec[1])
print("Chassis Number : ", rec[2])
print("Engine Number : ", rec[3])
print("Owner Name :", rec[4])
print("Owner Address : ", rec[5])
print("Owner Mobile Number : ", rec[6])
print("Dealer Name : ", rec[7])
print("Dealer Address : ", rec[8])
print("Dealer Phone Number : ", rec[9])
print("Vehicle Class : ", rec[10])
print("Fuel Type : ", rec[11])
print("Maker of Vehicle : ", rec[12])
print("Model of Vehicle : ", rec[13])
print("Type of body : ", rec[14])
print("Month and year of manufacture : ", rec[15])
print("Number of Cylinders : ", rec[16])
print("Horse Power : ", rec[17])
print("Cubic capacity : ", rec[18])
print("Wheel base : ", rec[19])
print("Seating capacity including driver : ", rec[20])
print("Colour of the Body : ", rec[21])
print("Unladen Weight : ", rec[22])
print("Gross Vehicle weight : ", rec[23])
print("Fitness Upto : ", rec[24])
print("Cost of Vehicle : ", rec[25])
print("Road Tax Paid Upto : ", rec[26])
print("Registration Authority : ", rec[27])
except EOFError:
fp.close()
menu()

def modifyreg():
rec = []
screg = input("Enter the Registration Number to be modified")
with open("xyz.dat", "rb") as fp:
fs = open("temp.dat", "wb")
try:
while True:
line = pickle.load(fp)
rec = line
if screg == rec[0]:
ch1 = input("Do you want to change Owner Information [Y/N]")
if ch1 == "Y" or ch1 == "Yes":
print("Old Name of the Owner:", rec[4])
rec[4] = input("New Name of the Owner :")
print("Old Address : ", rec[5])
rec[5] = input("New Address :")
print("Old Mobile Number : ", rec[6])
rec[6] = input("New Mobile Number :")
pickle.dump(rec, fs)
except EOFError:
fp.close()
fs.close()
os.remove("xyz.dat")
os.rename("temp.dat", "xyz.dat")
menu()


def delreg():
rec = []
screg = input("Enter the Registration Number to be deleted")
with open("xyz.dat", "rb") as fp:
fs = open("temp.dat", "wb")
try:
while True:
line = pickle.load(fp)
rec = line
if screg != rec[2]:
pickle.dump(rec, fs)
except EOFError:
fp.close()
fs.close()
os.remove("xyz.dat")
os.rename("temp.dat", "xyz.dat")
menu()


def menu():
print("\t\t Vehicle Registration System")
print("\t1. Create a Table")
print("\t2. Add a Record")
print("\t3. Display all Records")
print("\t4. Search a Record on Registration Number ")
print("\t5. Search a Record on Registration Date ")
print("\t6. Search Records on Owner Name ")
print("\t7. Search Records on Dealer Name ")
print("\t8. Search Records on Fuel Type ")
print("\t9. Search Records on Maker ")
print("\t10. Search Records on Model ")
print("\t11. Search Record on Registration Authority ")
print("\t12. Modify the Information for Registration Number")
print("\t13. Remove record from Table on Registration Number")
print("\t14. Exit ")
ch = int(input("Enter choice"))
if (ch == 1):
create()
if (ch == 2):
append()
if (ch == 3):
dispall()
if (ch == 4):
searchregno()
if (ch == 5):
searchregdt()
if (ch == 6):
ownername()
if (ch == 7):
dealername()
if (ch == 8):
fueltype()
if (ch == 9):
makername()
if (ch == 10):
modelname()
if (ch == 11):
regauthor()
if (ch == 12):
modifyreg()
if (ch == 13):
delreg()


menu()

Comments

Popular posts from this blog

Project 2