Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4,6 TrustPilot
logo-home
Document preview thumbnail
Preview 3 out of 19 pages
Exam (elaborations)

COS1512 Assignment 3 2024 (160814) - DUE 23 August 2024

Document preview thumbnail
Preview 3 out of 19 pages

COS1512 Assignment 3 2024 (160814) - DUE 23 August 2024 QUESTIONS AND ANSWERS

Content preview

COS1512 Assignment
3 2024 (160814) -
DUE 23 August 2024
QUESTIONS WITH COMPLETE ANSWERS




[School]
[Course title]

,COS1512 Assignment 3 2024 (160814) - DUE 23 August
2024

Question 1

Consider the following structure used to keep record of a student’s scores:
struct Student { string name; int quiz1; int quiz2; int midtermExam; int
finalExam; } A student is assessed according to the following policies:

1. The two quizzes are each marked out of 10.

2. The midterm exam and the final exam are each marked out of 100 marks.

3. The final exam counts for 50% of the grade, the midterm counts for 25%,
and the two quizzes together count for a total of 25%. (Do not forget to
normalize the quiz scores. They should be converted to a percentage before
they are averaged in.) Turn the student record into a class type rather than a
structure type. The student record class should have member variables for all
the input data. Make all member variables private. Include public member
functions for each of the following:

• a default constructor that sets the student ‘s name to a blank string, and all
the scores to 0;

• member functions to set each of the member variables to a value given as an
argument to the function (i.e. mutators);

• member functions to retrieve the data from each of the member variables
(i.e. accessors);

• and a function that calculates and returns the student’s weighted average
numeric score for the entire course. Use this class in program which grades a

, student. The program should read in the student’s name and scores and
output the student’s record as well as the student’s average numeric score for
the entire course. Use the keyboard to supply input and display the output on
the screen. Test your program with the following input: Student name:
Johnny Applemac Quiz 1: 7 Quiz 2: 5 Midterm exam: 65 Final exam: 73
Downloaded by Corona Virus () lOMoARcPSD| COS1512/103/2024 3

Here's how you can implement the described class in C++:

cpp

Copy code

#include <iostream>

#include <string>

using namespace std;



class Student {

private:

string name;

int quiz1;

int quiz2;

int midtermExam;

int finalExam;

Document information

Uploaded on
June 27, 2024
Number of pages
19
Written in
2023/2024
Type
Exam (elaborations)
Contains
Questions & answers
R49,34

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
msmartie11
3,9
(30)
Sold
246
Followers
224
Items
1232
Last sold
10 months ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their exams and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can immediately select a different document that better matches what you need.

Pay how you prefer, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card or EFT and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions