Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

List the names of subroutines of the hierarchy chart, and then write complete ps

ID: 653896 • Letter: L

Question

List the names of subroutines of the hierarchy chart, and then write complete pseudocode for the following problem. You will not have to create a data dictionary for this exercise.
Problem: Students get a discount on the tuition paid. The discount is based on a student's code and the registered number of course credits. A student with a code "M" for a military job, and registered for more than four credits is eligible for 5% discount on the tuition amount. A student with a code "C" for a corporate employee, and registered for more than six credits is eligible for 4% discount on the tuition amount.
Produce the pseudocode logic for an algorithm that will compute the tuition' discount for each student. The information is given as follows:
- The output will consist of a screen display showing the student's name, code, and discount received.
- The input will consist of the file with records containing the student's name, code, and tuition amount.
- The processing will compute the discount received by each student. If the student's code is other than "M" or "C", there should be no discount on the tuition amount.
Note: Your solution should contain a mainline, and at least three subroutines.

Explanation / Answer

/*
Description:
This program adds up sets of marks for students "Joe" abd "Sarah". It gives them a grade depending on their average mark (which is rounded so it is a whole number). "A" grade is a mark 85 or over; "B" is 65 to 84; "C" is 50 to 64; "D" for anything below 50.

Input: arrays of student marks
Output: each student's grade

Variables:
    joeMarks, sarahMarks, arrays of Numbers
    joeAverage, sarahAverage, Number type
    joeGrade, sarahGrade, String type

Functions:
    // This function returns the average of a set
    // of marks stored in the marks array
    // Variable: marks, array of numbers
    //           total, average, currentMark, Number type
    FUNCTION calcAverage(Parameters: marks)
        Set total to 0
        Set currentMark to first mark
        REPEAT the length of the marks array
            Add currentMark to total
            Set currentMark to next mark
        END REPEAT
        Set average to total divided by length
                                        of marks array rounded
        RETURN average
    END FUNCTION
  
    // This function returns a student's grade
    // according to their average mark
    // Variable: average, Number type
    //           grade, String type
    FUNCTION calcGrade(Parameters: average)
        IF average greater than 84 THEN
            Set grade to "A"
        ELSE IF average greater than 64 THEN
            Set grade to "B"
        ELSE IF average greater than 49 THEN
            Set grade to "C"
        ELSE IF average less than 50 THEM
            Set grade to "D"
        END IF
      
        RETURN grade
    END FUNCTION

    // This function displays a grade at coordinates x, y
    // for a student with name "name"
    // Variable: x, y, Number type
    //           name, grade, String type
    FUNCTION displayGrade(Parameters: name, x, y, grade)
        Set fill to black
        Set font to "century gothic"
        Set text size to 22
        Use text function to display at coordinates x, y
            "Student whose name is ", name,
            " has a grade of: ", grade
    END FUNCTION
  
Processing:
    // Process Sarah's marks and display grade
    Set sarahAverage to CALL calcAverage(sarahMarks)
    Set sarahGrade to CALL calcGrade(sarahAverage)
    displayGrade("Sarah", sarahGrade, 10,30)
  
    // Process Joes's marks and display grade
    Set joeAverage to CALL calcAverage(joeMarks)
    Set joeGrade to CALL calcGrade(joeAverage)
    displayGrade("Joe", joeGrade, 10,60)
  
Test items:
    Each function works as it should
    Grade is worked out correctly for each student
    Grade is displayed correctly within the confines
    of the output window
    Program does not respond to key or mouse events

*/

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote