Message

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 3

class Project:

def __init__(self):
pass

def input_proj(self, id_num, title, size, priority):


insert_list = [id_num, title, size, priority]
output_file = open("projects.txt", "a")
for list_item in insert_list:
output_file.writelines(str(list_item) + ", ")
output_file.write("\n")
output_file.close()

def one_project(self, project_id):


try:
file_row = []
with open("projects.txt", "r") as file:
for row in file:
if (row[0] == project_id):
file_row = row
except FileNotFoundError:
print("No project had been inserted.")
return False
else:
return file_row

def search_id(self, id):


with open("projects.txt", "r") as file:
for row in file:
if row[0] == id:
print(row)

def all_project(self):
with open("projects.txt", "r") as read_proj:
for item in read_proj:
print(item)

def Menu():
proj = Project()
while True:

print("\n*********** MENU ***********\n")


print("[1] Input Project Details")
print("[2] View Projects")
print("[3] Schedule Projects")
print("[4] Get a Project")
print("[5] Exit\n")
print("*****************************\n")

choice = eval(input("Enter your choice: "))

if choice == 1:
id_num = int(input("Enter ID: "))
title = str(input("Enter Title: "))
size = int(input("Enter size: "))
priority = int(input("Enter priority: "))

proj.input_proj(id_num, title, size, priority)


elif choice == 2:
print("[A] One Project")
print("[B] Completed Projects")
print("[C] All Projects")

sub_choice = str(input("Enter choice: ")).upper()


while True:
if sub_choice == 'A':
search_id = input("\nSearch by ID: ")
proj.search_id(search_id)
elif sub_choice == 'B':
print("entered completed projects")
elif sub_choice == 'C':
print("entered all projects")
proj.all_project()
else:
print("\n ****** Invalid Input! *****")

elif choice == 3:
print("[A] Create a Schedule")
print("[B] View updated Schedule")

sub_choice = str(input("Enter choice: ")).upper()

if sub_choice == 'A':
print("entered create a schedule")
elif sub_choice == 'B':
print("entered view updated schedule")
else:
print("\n ****** Invalid Input! *****")

elif choice == 4:
print("[A] Show a message that the topmost project from the queue is
removed. ")
print("[B] Place the removed project's details to the Completed
Projects text file")
print("[C] Display the queue showing that the topmost project has been
removed.")

sub_choice = str(input("Enter choice: ")).upper()

if sub_choice == 'A':
print("entered A")
elif sub_choice == 'B':
print("entered B")
elif sub_choice == 'C':
print("entered C")
else:
print("\n ****** Invalid Input! *****")

elif choice == 5:
break
else:
print("\n*********************************")
print("\tInvalid Input. Try Again!")
print("*********************************")
Menu()

You might also like