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
Exam (elaborations)

COS1512 ASSIGNMENT 03. DUE 23 AUGUST 2024.

Rating
5.0
(1)
Sold
1
Pages
43
Grade
A+
Uploaded on
17-07-2024
Written in
2023/2024

COS1512 ASSIGNMENT 03. DUE 23 AUGUST 2024. PASS WITH DISTINCTION-FORTIS PASSUM.

Institution
Course

Content preview

COS1512 ASSIGNMENT 03


Friday, 23 August 2024, 12:00 PM


Year Module 2024


PASS WITH DISTINCTIONS. FORTIS PASSUM


FOR FURTHER ASSISTANCE WITH ECONOMICS,
MANAGEMENT, ACCOUNTING, TAXATION EDUCATION@ LLB
MODULES.




CALL/WHATSAAP0816884518/0816884519
EMAIL:


,Question 1

#include <iostream>

#include <string>

class Student {

private:

std::string name;

int quiz1;

int quiz2;

int midtermExam;

int finalExam;

public:

// Default constructor

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

// Mutators

void setName(const std::string& studentName) {

name = studentName;

}

void setQuiz1(int score) {

quiz1 = score;

}

void setQuiz2(int score) {

quiz2 = score;

}

,void setMidtermExam(int score) {

midtermExam = score;

}

void setFinalExam(int score) {

finalExam = score;

}

// Accessors

std::string getName() const {

return name;

}

int getQuiz1() const {

return quiz1;

}

int getQuiz2() const {

return quiz2;

}

int getMidtermExam() const {

return midtermExam;

}

int getFinalExam() const {

return finalExam;

}

, // Function to calculate the weighted average score

double calculateAverage() const {

double quizPercentage = (static_cast<double>(quiz1) / 10 +
static_cast<double>(quiz2) / 10) / 2 * 100;

double average = (quizPercentage * 0.25) + (midtermExam * 0.25) + (finalExam *
0.50);

return average;

}

};

int main() {

Student student;



// Input the student data

std::string name;

int quiz1, quiz2, midtermExam, finalExam;



std::cout << "Student name: ";

std::getline(std::cin, name);

student.setName(name);



std::cout << "Quiz 1: ";

std::cin >> quiz1;

student.setQuiz1(quiz1);

Written for

Institution
Course

Document information

Uploaded on
July 17, 2024
Number of pages
43
Written in
2023/2024
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

$3.63
Get access to the full document:

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

Reviews from verified buyers

Showing all reviews
1 year ago

5.0

1 reviews

5
1
4
0
3
0
2
0
1
0
Trustworthy reviews on Stuvia

All reviews are made by real Stuvia users after verified purchases.

Get to know the seller

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.
distinctiongateway Gateway To Distinctions
Follow You need to be logged in order to follow users or courses
Sold
253
Member since
2 year
Number of followers
114
Documents
102
Last sold
3 weeks ago
Gateway to Distinctions

4.4

30 reviews

5
19
4
6
3
3
2
2
1
0

Trending documents

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

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

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

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

Student with book image

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

Alisha Student

Frequently asked questions