0% found this document useful (0 votes)
13 views2 pages

Output Code

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views2 pages

Output Code

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

#ifndef OBJECTS_H

#define OBJECTS_H

#include <string>
#include <vector>

class Car {
private:
std::string make;
std::string model;
int year;
float engineDisplacement;
bool isElectric;

public:
// Constructor
Car(std::string m, std::string mod, int y, float engine, bool electric)
: make(m), model(mod), year(y), engineDisplacement(engine), isElectric(electric) {}

// Getter methods
std::string getMake() const { return make; }
std::string getModel() const { return model; }
int getYear() const { return year; }
float getEngineDisplacement() const { return engineDisplacement; }
bool getIsElectric() const { return isElectric; }

// Setter methods
void setMake(std::string m) { make = m; }
void setModel(std::string mod) { model = mod; }
void setYear(int y) { year = y; }
void setEngineDisplacement(float engine) { engineDisplacement = engine; }
void setIsElectric(bool electric) { isElectric = electric; }

// Method stubs
void startEngine() {}
void stopEngine() {}
void accelerate(float speed) {}
void brake() {}
};

class Person {
private:
std::string name;
int age;
std::string address;

public:
// Constructor
Person(std::string n, int a, std::string addr)
: name(n), age(a), address(addr) {}

// Getter methods
std::string getName() const { return name; }
int getAge() const { return age; }
std::string getAddress() const { return address; }

// Setter methods
void setName(std::string n) { name = n; }
void setAge(int a) { age = a; }
void setAddress(std::string addr) { address = addr; }
// Method stubs
void speak() {}
void walk() {}
void eat() {}
};

class Student : public Person {


private:
std::string studentId;
std::vector<std::string> enrolledCourses;
float gpa;

public:
// Constructor
Student(std::string n, int a, std::string addr, std::string id, float gradePointAvg)
: Person(n, a, addr), studentId(id), gpa(gradePointAvg) {}

// Getter methods
std::string getStudentId() const { return studentId; }
std::vector<std::string> getEnrolledCourses() const { return enrolledCourses; }
float getGPA() const { return gpa; }

// Setter methods
void setStudentId(std::string id) { studentId = id; }
void addCourse(std::string course) { enrolledCourses.push_back(course); }
void setGPA(float gradePointAvg) { gpa = gradePointAvg; }

// Method stubs
void study() {}
void takeExam() {}
void submitAssignment() {}
};

#endif // OBJECTS_H

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy