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 inputEnter your name:"
#Ask user to enter their Student ID
StudentId inputEnter your Student ID:
#Ask useer to enter their current year
year inputEnter your current year:
#Ask user to enter their GPA
GPA inputEnter your GPA:
#Ask user to enter their major
Major inputEnter your major Computational Systems, Social Innovations, Business Transformation:
#Welcome message
printfWelcomenameYour student ID is StudentId 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 :
#Display the options for the user
printPlease choose one of the following options:"
print Display the list of courses"
print Go to 'Course Registration'"
print Quit the system"
#Ask the user for their choice
choice inputEnter your choice or :
#If the user chooses to display the list of courses
if choice :
#Display the available courses
printList of Courses:"
printCS CS ICB IDS ICB SI
printCS ICB IDS ICB SI
printCS CS ICB IDS ICB SI
printCS CS IC IDS ICB SI
#If the user chooses to go to the course registration
elif choice :
printCourse Registration: This is a placeholder for course registration process"
#If the user chooses to quit the system
elif choice :
printThank you for using the system! Have a great day!"
#If the user enters invalid choice ask them to try again
else:
printInvalid choice, please try again."
# Ask user to enter their information
gpa floatinputEnter your GPA:
yearlevel intinputEnter your year level :
# Calculate maximum credit hours based on GPA
if gpa :
maxhours
elif gpa :
maxhours
else:
maxhours
totalcredithours
continueprompting True
while continueprompting:
coursecode inputEnter course code or 'quit' to proceed to payment calculation:
if coursecode.lower 'quit':
continueprompting False
else:
# Check if the course code starts with a digit
if coursecodeisdigit:
courseyearlevel intcoursecode
# Check if the course level is appropriate
if courseyearlevel or courseyearlevel :
printInvalid course level. enter a level between and
continue
elif courseyearlevel yearlevel:
printfYou can't register for a course level higher than your year yearlevel
else:
# Check if the student has reached the max credit hours
if totalcredithours maxhours:
printfYou have reached the maximum credit hours maxhours
continueprompting False
else:
# Register the course
totalcredithours
printfYou have successfully registered for course coursecode
else: # This else block was misaligned
printInvalid Course code. Course code should start with a digit indicating the year level."
# Display total credit hours
printfTotal registered credit hours: totalcredithours
#payment calculation
costpercredithour
totalpaymentbeforediscount totalcredithours costpercredithour
discount
#calculate discount based on GAP and year level
if gpa and yearlevel :
discount totalpaymentbeforediscount
discount
elif gpa and yearlevel :
discount totalpaymentbeforediscount
#caculate final payment
finalpayment totalpaymentbeforediscount discount
#show payment details
printftotal payment before discount:totalpaymentbeforediscount AED"
printfDiscount applied: discountAED
printfFinal payment amount: finalpaymentAED
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
