Skip to content

Commit b8eafdc

Browse files
authored
Add files via upload
1 parent 5e4a5ee commit b8eafdc

File tree

2 files changed

+100
-0
lines changed

2 files changed

+100
-0
lines changed

store_program.py

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
class Store:
2+
def __init__(self):
3+
self.products = {}
4+
5+
def add_product(self, code, name, price):
6+
self.products[code] = {'name': name, 'price': price}
7+
8+
def display_menu(self):
9+
print("Menu:")
10+
print("Code\tName\tPrice")
11+
for code, product in self.products.items():
12+
print(f"{code}\t{product['name']}\t{product['price']}")
13+
14+
def generate_bill(self, order):
15+
total_amount = 0
16+
print("\n------------------ RECEIPT ------------------")
17+
print("Code\tName\tPrice\tQuantity\tTotal")
18+
for code, quantity in order.items():
19+
product = self.products[code]
20+
item_total = quantity * product['price']
21+
total_amount += item_total
22+
print(f"{code}\t{product['name']}\t{product['price']}\t{quantity}\t\t{item_total}")
23+
24+
print("\nTotal Amount: ₹{:.2f}\n".format(total_amount))
25+
26+
27+
def main():
28+
store = Store()
29+
30+
store.add_product('001', 'Bread', 25.00)
31+
store.add_product('002', 'Chips', 15.00)
32+
store.add_product('003', 'KitKat', 10.00)
33+
store.add_product('004', 'Coke', 20.00)
34+
store.add_product('005', 'Biscuit', 12.00)
35+
store.add_product('006', 'Butter', 35.00)
36+
store.add_product('007', 'Rice', 30.00)
37+
store.add_product('008', 'Lentils', 35.00)
38+
store.add_product('009', 'Suji', 40.00)
39+
store.add_product('010', 'Spice', 20.00)
40+
41+
store.display_menu()
42+
43+
order = {}
44+
while True:
45+
code = input("Enter the product code (or 'done' to finish): ")
46+
if code.lower() == 'done':
47+
break
48+
elif code in store.products:
49+
quantity = int(input(f"Enter the quantity for {store.products[code]['name']}: "))
50+
order[code] = quantity
51+
else:
52+
print("Invalid product code. Please enter a valid code.")
53+
54+
store.generate_bill(order)
55+
56+
57+
if __name__ == "__main__":
58+
main()

student_admit.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
class Student:
2+
3+
count = 0
4+
5+
def __init__(self):
6+
self.name = input("Enter Student Name: ")
7+
self.age = int(input("Enter Student Age: "))
8+
self.department = input("Enter Student Department (PGDM(p)/B.Tech(b)): ").capitalize()
9+
10+
Student.count += 1
11+
12+
def display(self):
13+
print("Name:", self.name, "Age:", self.age, "Department:", self.department)
14+
15+
print("""------ STUDENT ADMIT ------""")
16+
17+
pgdm_students = []
18+
btech_students = []
19+
20+
num_students = int(input("Enter The Total Number Of Students: "))
21+
22+
for _ in range(num_students):
23+
new_student = Student()
24+
new_student.display()
25+
26+
if new_student.department == 'P':
27+
pgdm_students.append(new_student)
28+
29+
elif new_student.department == 'B':
30+
btech_students.append(new_student)
31+
32+
print("*****************")
33+
34+
print("\nTotal PGDM Department Students:")
35+
for student in pgdm_students:
36+
student.display()
37+
38+
print("\nTotal B.Tech Department Students:")
39+
for student in btech_students:
40+
student.display()
41+
42+
print("\nTotal Number Of students:", Student.count)

0 commit comments

Comments
 (0)