Output Code
Output Code
#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() {}
};
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