100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
COS1512 Assignment 3 2024 (160814) - DUE 23 August 2024 R54,19   Add to cart

Exam (elaborations)

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

 2 views  0 purchase

COS1512 Assignment 3 2024 (160814) QUESTIONS AND ANSWERS

Preview 3 out of 16  pages

  • June 27, 2024
  • 16
  • 2023/2024
  • Exam (elaborations)
  • Questions & answers
All documents for this subject (39)
avatar-seller
smillanih
COS1512
Assignment 3 2024
(160814) - DUE 23
August 2024
QUESTIONS WITH COMPLETE ANSWERS




[DATE]
[COMPANY NAME]
[Company address]

,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;



public:

// Default constructor

Student() : name(""), quiz1(0), quiz2(0), midtermExam(0), finalExam(0) {}



// Mutator functions to set values

void setName(string studentName) {

name = studentName;

}

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through EFT, credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying this summary from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller smillanih. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy this summary for R54,19. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

73243 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy summaries for 14 years now

Start selling
R54,19
  • (0)
  Buy now