Question: create a flow chart for this code : #Ask user to enter their name name = input ( Enter your name: ) #Ask user

create a flow chart for this code :
#Ask user to enter their name
name = input("Enter your name:")
#Ask user to enter their Student ID
Student_Id= input("Enter your Student ID:")
#Ask useer to enter their current year
year= input("Enter your current year(1-4):")
#Ask user to enter their GPA
GPA= input("Enter your GPA(0.0-4.0):")
#Ask user to enter their major
Major= input("Enter your major (Computational Systems, Social Innovations, Business Transformation):")
#Welcome message
print(f"Welcome,{name}.Your student ID is {Student_Id}, you are in year {year}, your GPA is {GPA}, your major is { Major}.")
#The users choice
choice =""
#Loop until the user chooses to quit the system
while choice !='3':
#Display the options for the user
print("Please choose one of the following options:")
print("1. Display the list of courses")
print("2. Go to 'Course Registration'")
print("3. Quit the system")
#Ask the user for their choice
choice = input("Enter your choice (1,2, or 3): ")
#If the user chooses to display the list of courses
if choice =='1':
#Display the available courses
print("List of Courses:")
print("CS101, CS102, ICB101, IDS101, ICB102, SI102")
print("CS202, ICB101, IDS201, ICB202, SI202")
print("CS301, CS302, ICB301, IDS301, ICB302, SI302")
print("CS401, CS402, IC401, IDS401, ICB402, SI402")
#If the user chooses to go to the course registration
elif choice =='2':
print("Course Registration: This is a placeholder for course registration process")
#If the user chooses to quit the system
elif choice =='3':
print("Thank you for using the system! Have a great day!")
#If the user enters invalid choice , ask them to try again
else:
print("Invalid choice, please try again.")
# Ask user to enter their information
gpa = float(input("Enter your GPA: "))
year_level = int(input("Enter your year level (1-4): "))
# Calculate maximum credit hours based on GPA
if gpa <2.0:
max_hours =12
elif 2.0<= gpa <=3.5:
max_hours =15
else:
max_hours =18
total_credit_hours =0
continue_prompting = True
while continue_prompting:
course_code = input("Enter course code (or 'quit' to proceed to payment calculation): ")
if course_code.lower()== 'quit':
continue_prompting = False
else:
# Check if the course code starts with a digit
if course_code[0].isdigit():
course_year_level = int(course_code[0])
# Check if the course level is appropriate
if course_year_level <1 or course_year_level >4:
print("Invalid course level. enter a level between 1 and 4.")
continue
elif course_year_level > year_level:
print(f"You can't register for a course level higher than your year ({year_level}).")
else:
# Check if the student has reached the max credit hours
if total_credit_hours +3> max_hours:
print(f"You have reached the maximum credit hours ({max_hours}).")
continue_prompting = False
else:
# Register the course
total_credit_hours +=3
print(f"You have successfully registered for course {course_code}.")
else: # This else block was misaligned
print("Invalid Course code. Course code should start with a digit (1-4) indicating the year level.")
# Display total credit hours
print(f"Total registered credit hours: {total_credit_hours}")
#payment calculation
cost_per_credit_hour=5000
total_payment_before_discount = total_credit_hours * cost_per_credit_hour
discount =0
#calculate discount based on GAP and year level
if gpa >3.0 and year_level >=3:
discount = total_payment_before_discount *0.20
discount -=100
elif gpa >3.5 and year_level <=2:
discount = total_payment_before_discount *0.15
#caculate final payment
final_payment = total_payment_before_discount - discount
#show payment details
print(f"total payment before discount:{total_payment_before_discount} AED")
print(f"Discount applied: {discount}AED")
print(f"Final payment amount: {final_payment}AED")

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!