Create an object structure called Mark that will be used to store information about a mark for various assignments, tests, etc. Use appropriate variable types to store:

  • The assignment name
  • The total possible marks and the students mark , ie. 19.5 out of 24
  • The weight (used to calculate the students combined overall average)

The default constructor without arguments should set the assignment name to an empty string, the total to 1, the students mark to 0 and the weight to 1. The total and weight must be 1 to avoid dividing by zero.

An alternate constructor should use the assignment name, total, mark and weight.

Another alternate constructor should use just the assignment name, total and mark (the weight will default to 1).

Object methods should include:

  • Getters for each object variable (getAssignment, getMark, getTotal, getWeight)
  • A setter for the students mark only (setMark)
  • A method to calculate the percentage mark (calcAverage)
  • A method to display its details (showEntry) only show up to 40 characters of the assignment name: Chapter 1 Assignment Allow up to 40 ch 17.5 / 24 72.9%

Complete and print your object class before continuing.

Create a markbook app that allows a teacher to input up to 20 mark entries and calculate the overall average at any time. The app should use an array of 20 Mark objects to store the marks for a single student only. (Yes, this implementation isnt very practical.)

The user should be able to:

  • Calculate the overall weighted average only
  • List all the non-empty mark entries and the overall weighted average
  • Add a new mark entry (to the first non-empty mark entry you may want to keep track of the number of mark entries)
    • If there are already 20 marks entered, do not allow a new mark entry
  • Delete an entry (and leave all subsequent entries in their spots)
    • List the mark entry details and confirm the delete request
  • Update the mark on an existing non-empty mark entry
  • Exit (will not save any data)

These functions should be written using methods as appropriate.

Example output: Main Menu

Main Menu (11 mark entries)
1. Calculate the current overall weighted average
2. List all entries and overall weighted average
3. New mark entry
4. Delete a mark entry
5. Update an existing mark
0. Exit
What would you like to do? ___

Example output: Current average

Student's current OWA is 84.3%

Example output: List all marks

Current Mark Entries
--------------------

1. Chapter 1 Assignment – Allow up to 40 ch 17.5 / 24 72.9%
2. Chapter 1 Test – Allow up to 40 characte 37.0 / 40 92.5%
...
10. Chapter 4 Activity – Allow up to 40 char 27.0 / 35 77.1%

Overall Weighted Average: 84.3%

Example output: New mark entry

New Mark Entry
--------------


Chapter 1 Assignment – Allow up to 40 characters

Enter the total mark: 24
Enter the student’s mark: 17.5

Enter the weight (default 1): _

Please check the mark entry:
Chapter 1 Assignment – Allow up to 40 ch
Student mark: 17.5 / 24
Weight: 1
Is this correct? Y

Example output: Delete mark entry

Delete Mark Entry
--------------------

1. Chapter 1 Assignment – Allow up to 40 ch
2. Chapter 1 Test – Allow up to 40 characte
...
10. Chapter 4 Activity – Allow up to 40 char

Which entry would you like to delete? 2

You have requested to delete the following mark entry:
Chapter 1 Test – Allow up to 40 characte
Student mark: 37.0 / 40
Weight: 4
Is this correct?

Example output: Update mark entry

Update Mark Entry
--------------------

1. Chapter 1 Assignment – Allow up to 40 ch
2. Chapter 1 Test – Allow up to 40 characte
...
10. Chapter 4 Activity – Allow up to 40 char

Which entry would you like to update? 10

Current mark entry:
Chapter 4 Activity – Allow up to 40 char
Student mark: 27.0 / 35
Weight: 1
Please input new student mark: 29

Other notes:

  • The mark descriptors should only be 40 characters long you may either truncate it and store the descriptor with 40 characters, or only display the first 40 characters when listing the entries by using printf.
  • Use a method to display the list of mark descriptors, with a flag to display the full mark details, i.e.: listMarks(marks array, TRUE if details required/FALSE if descriptors only) This will be allow you to use a single method to display full mark details, or only the titles for deletion
  • Use a method to display the full details of a particular mark entry for verification
  • Use a method to calculate the overall weighted average
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.