QuestionQuestion

Background Information

This assignment tests your understanding of and ability to apply the programming concepts we have covered in the unit so far, including the usage of variables, input and output, data types, selection, iteration, functions and data structures. Above all else, it tests your ability to design and then implement a solution to a problem using these concepts.

Assignment Overview

You are required to design and implement a “Student Grades” program that allows the user to input the assessment marks for students in a class. The program uses this information to determine and display information such as student grades (e.g. “Distinction”). The program displays information on both a per-student / per-assessment basis, as well as some aggregated data such as a class average. Details of the program requirements can be found in the “Program Requirements” section. The entirety of this program can be implemented in approximately 100 lines of code. Ask your tutor for advice if you feel your program is unusually long or inefficient.

Pseudocode

As emphasized by the case study of Module 5, it is important to take the time to properly design a solution before starting to write code. Hence, this assignment requires you to write and submit a pseudocode of your program design as well as the code for the program. Furthermore, while your tutors are happy to provide help and feedback on your assignment work throughout the semester, they will expect you to be able to show your pseudocode and explain the design of your code. You will gain a lot more benefit from pseudocode if you actually attempt it before trying to code your program – even if you just start with a rough draft to establish the overall program structure, and then revise and refine it as you work on the code. This back and forth cycle of designing and coding is completely normal and expected, particularly when you are new to programming. The requirements detailed on the following pages should give you a good idea of the structure of the program, allowing you to make a start on designing your solution in pseudocode.

Program Requirements

Below are the detailed requirements of the program you must implement. In the following information, numbered points describe a core requirement of the program, and bullet points (in italics) are additional details, notes and hints regarding the requirement. Refer to the earlier information or ask your tutor if you do not understand a requirement or would like further details.

1.Prompt the user to input the number of assessments that the unit has.

This value will be referred to as “numAssessments” in this assignment brief. Remember to convert numeric inputs such as this to integers so that you can use them as intended!

2.For each assessment, prompt the user to input a name (e.g. “Essay”, “Exam”…) and value (how many marks it is worth). Store these values in two separate lists – a list of assessment names(strings) and another list of assessment values (integers).

Use a loop that repeats numAssessments times. Prompt for the name and value and append them to the lists inside the body of the loop.

3.After the user has entered the name and value for all assessments, if the assessment values do not add up to 100 the program should show an error message and end. If the assessment valuesDO add up to 100, prompt the user to enter the number of students in the class.

This value will be referred to as “numStudents” in this assignment brief.

4.Enter a loop that repeats numStudents times. The body of this loop must:

4.1. Prompt the user to type the student’s name and store it into a variable.

4.2. Enter a loop that repeats numAssessments times. The body of this loop must:

Note that the loop for assessments is inside the body of the loop for students – this is how the program can prompt for the appropriate number of assessments per student.

4.2.1. Prompt the user to input the current student’s mark for the current assessment.

The prompt for input should include the current student’s name, as well as the name and value of the current assessment, e.g. “What did Joe get out of 20 in the Essay?”

4.2.2. If the mark entered by the user is below 0, set it to 0. If the mark is above the value of the current assessment, set it to the value of the current assessment.

e.g. If the user enters a mark of 30 for an assessment with a value of 20, change the mark to20.This is simply to ensure that the mark is valid – alternatively, you can use a loop to re-prompt the user for input until they provide a valid mark.

4.2.3. Determine and print the grade corresponding to the assessment mark by using the “calculateGrade” function (detailed later in this assignment brief).

4.3. After obtaining marks for all assessments for a student, the program must determine the student’s total mark and display a message which includes their name and their final grade, e.g. “Joe has a total mark of 72 (Distinction)”.

5.The last thing the program should (after looping through all of the students) do determine and print the average mark (and corresponding grade) for the class as a whole, and the name and total mark of the top student – i.e. the student with the highest total mark.

Solution PreviewSolution Preview

These solutions may offer step-by-step problem-solving explanations or good writing examples that include modern styles of formatting and construction of bibliographies out of text citations and references. Students may use these solutions for personal skill-building and practice. Unethical use is strictly forbidden.

# Function to calculate grade
def calculateGrade(mark):
    if mark >= 0.8:
       return "High Distinction"
    elif mark >= 0.7:
       return "Distinction"
    elif mark >= 0.6:
       return "Credit"
    elif mark >= 0.5:
       return "Pass"
    else:
       return "Fail"

# Main function with program code
def main():
    # Prompt user for number of assessments
    numAssessments = int(input("How many assessments?: "))
    # Prompt user for assessment names and values
    assessmentNames = []
    assessmentValues = []
    for i in range(numAssessments):
       assessmentName = input("Enter name of assessment " + str(i+1) +": ")
       assessmentNames.append(assessmentName)
       assessmentValue = int(input("How many marks is the " + assessmentName + " worth?: "))
       assessmentValues.append(assessmentValue)

    # If sum of assessment values is not 100
    assessmentTotal = sum(assessmentValues)
    if assessmentTotal != 100:
       # Show error message
       print("Error: The assessment values do not add up to 100 points.")
    # Else
    else:
       print("")
       studentNames = []
       studentGrades...

By purchasing this solution you'll be able to access the following files:
Solution.py, Solution.docx and Solution.PNG.

50% discount

Hours
Minutes
Seconds
$55.00 $27.50
for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Python Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Decision:
Upload a file
Continue without uploading

SUBMIT YOUR HOMEWORK
We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats