Reference no: EM132977018
CSI6208 Programming Principles - Edith Cowan University
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 and structures, selection, iteration and functions. 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 first specify the assessments that exist in a unit, and then to enter the marks that each student received for those assessments. 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 under 150 lines of code (although implementing optional additions may result in a longer program). This number is not a limit or a goal - it is based upon an average quality implementation that includes comments and blank lines. It is simply provided to prompt you to ask your tutor for advice if your program significantly exceeds it.
Program Requirements
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. Ask your tutor if you do not understand the requirements or would like further information.
1. Prompt the user to enter the number of assessments that the unit has.
• This value will be referred to as num_assessments in this assignment brief.
• Remember to convert numeric inputs such as this to integers so that you can use them as intended!
• In this assignment we assume the user will always enter an integer when asked to enter an integer.
2. For each assessment, prompt the user to enter 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 num_assessments times.
• Prompt for the name and value and append them to the lists inside the body of the loop.
3. Include code to check that the user enters a number that is at least 1 when they are prompted to enter the number of assessments, number of students and assessment values. If they enter a value that is less than 1, show an error message and either end the program or continue to re- prompt them until they enter a valid value.
4. 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 values DO add up to 100, prompt the user to enter the number of students in the class.
• This value will be referred to as num_students in this assignment brief.
5. Enter a loop that repeats num_students times. The body of this loop must:
5.1. Prompt the user to enter the student's name and store it into a variable.
5.2. Enter a loop that repeats num_assessments times. The body of this loop must:
• Note that the loop for assessments is i nside the body of the loop for students - this is how the program can prompt for the appropriate number of assessments per student.
5.2.1. Prompt the user to enter 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?"
5.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
to 20. 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 enter a valid mark.
5.2.3. Determine the grade that the student received using the calculate_grade()
function (detailed on the following page), and display it to the user.
• The calculate_grade() function expects a value out of 100, so be sure to convert the mark appropriately using the assessment's value, e.g. 13 out of 20 converts to 65.
• The message displayed to the user should include the mark, assessment value, and the
grade, e.g. "13 out of 20 is a Credit."
5.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)".
• This occurs inside the body of the loop that repeats once per student, but after (and not part of) the loop that repeats once per assessment. Refer to the overview in the Pseudocode section.
• The calculate_grade() function can be used to determine the student's final grade. You will need to keep a running total of their assessment marks (see Workshop 3, Task 4 for a similar task).
6. The last thing the program should do (after looping through all of the students) is 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.
• It is up to you to figure out how to calculate these values. It will involve using variables to keep track of
certain pieces of information throughout earlier parts of the program.
• Round the average mark of the class to the nearest integer and show it without decimal places, e.g. show "68" instead of "68.0" or "68.125".
Attachment:- Programming Principles.rar