Function definition Academic Essay

PROACTIVE POLICING TACTICS TO COMBAT CRIME
October 3, 2020
Faults of federalism Academic Essay
October 3, 2020

Function definition Academic Essay

Question 1: Write the definition of a menu function such that when it executes it prompts the user to enter 1 or 2 or 3. Further if the user enters 1 it invokes the enter All Mkar s Of A Student To Storage function and if the user enters 2 it invokes the displayAllReports function and if the user enter 3 it exits the program.

At this stage do not bother about the finer details of enterAllMkarksOfAStudentToStorage and displayAllReports. That is assume the ad-hoc function definition of enterAllMkarksOfAStudentToStorage is specified as follows: def enterAllMkarksOfAStudentToStorage(): print(“The enterAllMkarksOfAStudentToStorage function got invokedn”) Similarly assume the ad-hoc function definition of displayAllReports is specified as follows: def displayAllReports (): print(“The displayAllReports function got invokedn”)

Question 2:

Using similar reasoning re-write the displayAllReports function definition. That is when displayAllReports gets invoked it should prompt the user to enter:

1 for the invocation of getBelowAvgDFReportMarksReport

2 for the invocation of getBelowAvgProjectMarksReport

3 for the invocation of getBelowAvgFinalExamMarksReport

4 for the invocation of getBelowAvgOverallMarksReport

5 for the invocation of displaySelectedStudentsMarks

6 to return to the menu function

Note: As you have done for question 1 user similarly ad-hoc function definitions for each of the above mentioned function definitions.

Question 3:

Since you have learnt while loops in week 6, you will have to change the function definitions of the menu function such that the program exits only if the user enters 3. Remember in week 5 your program was exiting even if you did not enter 3. This can be done using a while loop.

Question 4:

Similarly you have to change the function definition of enterAllMkarksOfAStudentToStorage such that the user may enter valid marks for DF Report, Project and Final exam for a student. This would also mean entering the name of the student. You may recall that the valid mark for a DF Report is between 0 and 20. Similarly a valid mark for Project is between 0 and 30 and that for the final exam is between 0 and 50. Use the while loop to ensure that the program repeatedly asks the user to enter the valid marks if a wrong entry is made for any of the 3 assessments.

Observe from the figure given on page 1 that the enterAllMkarksOfAStudentToStorage function invokes the searchStudentMarks function to find if a new student’s name (or similar uniquely identifiable detail) already exists in the storage. We will not want to get distracted by this detail at the moment. Hence write a dummy function definition for searchStudentMarks as follows:

def searchStudentMarks (keyToSearch): print(“The searchStudentMarks function got invokedn”)

Do you want your assignment written by the best essay experts? Then look no further. Our teams of experienced writers are on standby to deliver to you a quality written paper as per your specified instructions. Order now, and enjoy an amazing discount!!
find the cost of your paper
Is this question part of your assignment?
Place order
Posted on May 6, 2016Author TutorCategories Question, Questions