Created
June 17, 2025 20:52
-
-
Save thinkphp/b19b1e8acaa09f02043637b2bdb7990f to your computer and use it in GitHub Desktop.
Rental
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def display_menu():a | |
""" | |
Afiseaza menu-ul principal al aplicatiei | |
""" | |
print("\n" + "="*40) | |
print(" RENTAL Management MENU") | |
print("="*40) | |
print("1. Enter rental property details") | |
print("2. Display summary data for rentals") | |
print("3. Exit") | |
print("=" * 40) | |
def property_data(): | |
""" | |
Subrutina pentru optinea - Enter rental property details | |
in aceasta etapa afiseaza doar un mesaj informativ | |
""" | |
print("\n --- Enter Property Details ---") | |
print("This function will be implemented in Task2") | |
input("Press Enter to continue...") | |
def summary_data(): | |
""" | |
Subrutina pentru optiunea 2 - Display summary rentals | |
in aceasta etapa afiseaza doar un mesaj informativ | |
""" | |
print("\n --- Property Summary ----") | |
print("This function will be implemented in task2") | |
input("Press Enter to continue...") | |
def exit_program(): | |
""" | |
Subrutina pentru optiunea 3 - Exit | |
Afiseaza mesaj de i esire si termina programul | |
""" | |
print("\n --- EXIT Program ----") | |
print("Thank you for using the REntal Management System!") | |
def get_user_choice(): | |
""" | |
Obtine si valideaza alegerea utilizatorului | |
Returns: int - optiunea valida aleasa de utilizator (1, 2, sau 3) | |
""" | |
while True: | |
try: | |
#citim de la tastatura un input si il trasmitem variabilei choice care va trebui sa fie convertita la multimea numerelor intregi | |
choice = input("Please enter your choice (1-3): ") | |
#convertim la integer | |
choice_int = int(choice) | |
#valideaza daca optiunea este in intervalul corect | |
if choice_int in [1,2,3]: | |
return choice_int | |
else: | |
print("Error: Please enter a valid option (1,2, or 3)") | |
except ValueError: | |
#gestioneaza cazul cand utilizatorul introduce text nevalid | |
print("Error: Please enter a valid number (1,2, or 3)") | |
def main(): | |
""" | |
Functia principala care controleaza fluxul programului | |
Implementeaza logica menu-ului principal conform diagramei de flux | |
""" | |
print("Welcome to the Rental Property Management System") | |
#bucla principala | |
while True: | |
#afiseaza menu | |
display_menu() | |
#obtine alegerea validata a utilizatorului | |
user_choice = get_user_choice() | |
#executa actiunea corespunzatoare alegerii utilizatorului | |
if user_choice == 1: | |
#call function | |
property_data() | |
elif user_choice == 2: | |
summary_data() | |
elif user_choice == 3: | |
exit_program() | |
break #iesire din bucla principala | |
print("\nReturning to main menu...") | |
# pentru a executa o functie in orice limbaj de programare : numele functie plus () | |
#punctul de intrare in program | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment