From b44710c5370129d59a2d2e12c70bac9269f7ecd5 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Thu, 16 May 2024 17:23:23 -0700 Subject: f --- .tup/db | Bin 0 -> 86016 bytes .tup/object | 0 .tup/shared | 0 .tup/tri | 0 .vscode/settings.json | 11 +++++++++++ College.hh | 30 ++++++++++++++++++++++++++++++ College_Impl.cpp | 29 +++++++++++++++++++++++++++++ High_School.hh | 24 ++++++++++++++++++++++++ High_School_Impl.cpp | 0 School_Driver.cpp | 9 +++++++++ Tupfile | 8 ++++++++ University.hh | 26 ++++++++++++++++++++++++++ University_Impl.cpp | 11 +++++++++++ build/College_Impl.o | Bin 0 -> 161648 bytes build/High_School_Impl.o | Bin 0 -> 1008 bytes build/School_Driver.o | Bin 0 -> 28360 bytes build/University_Impl.o | Bin 0 -> 142952 bytes build/cst_136_assignment_07 | Bin 0 -> 5422808 bytes 18 files changed, 148 insertions(+) create mode 100644 .tup/db create mode 100644 .tup/object create mode 100644 .tup/shared create mode 100644 .tup/tri create mode 100644 .vscode/settings.json create mode 100644 College.hh create mode 100644 College_Impl.cpp create mode 100644 High_School.hh create mode 100644 High_School_Impl.cpp create mode 100644 School_Driver.cpp create mode 100644 Tupfile create mode 100644 University.hh create mode 100644 University_Impl.cpp create mode 100644 build/College_Impl.o create mode 100644 build/High_School_Impl.o create mode 100644 build/School_Driver.o create mode 100644 build/University_Impl.o create mode 100755 build/cst_136_assignment_07 diff --git a/.tup/db b/.tup/db new file mode 100644 index 0000000..f326a8e Binary files /dev/null and b/.tup/db differ diff --git a/.tup/object b/.tup/object new file mode 100644 index 0000000..e69de29 diff --git a/.tup/shared b/.tup/shared new file mode 100644 index 0000000..e69de29 diff --git a/.tup/tri b/.tup/tri new file mode 100644 index 0000000..e69de29 diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..fc334da --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,11 @@ +{ + "files.exclude": { + "**/.git": true, + "**/.svn": true, + "**/.hg": true, + "**/CVS": true, + "**/.DS_Store": true, + "**/Thumbs.db": true + }, + "hide-files.files": [] +} diff --git a/College.hh b/College.hh new file mode 100644 index 0000000..5d75e42 --- /dev/null +++ b/College.hh @@ -0,0 +1,30 @@ +#pragma once + +#include "University.hh" + +class College { +private: + std::string college_name; + std::string college_location; + int college_rank; + double reqd_gpa_for_admit; + University university_pin; + +public: + College() {} + College(std::string name, int rank, double gpa) + : college_name(name), college_rank(rank), reqd_gpa_for_admit(gpa) {} + College(std::string name, std::string location, int rank, double gpa, + University pin) + : college_name(name), college_location(location), college_rank(rank), + reqd_gpa_for_admit(gpa), university_pin(pin) {} + + void set_college_name(std::string); + std::string get_college_name(); + void set_college_location(std::string); + std::string get_college_location(); + + //......other setters and getters + // void operator==(const University&); + void print_pin(const University &); +}; diff --git a/College_Impl.cpp b/College_Impl.cpp new file mode 100644 index 0000000..6f9c66c --- /dev/null +++ b/College_Impl.cpp @@ -0,0 +1,29 @@ +#include +#include +#include + +#include "College.hh" +#include "University.hh" + +auto College::set_college_name(std::string name) -> void { + this->college_name = std::move(name); +} + +auto College::get_college_name() -> std::string { return this->college_name; } + +auto College::set_college_location(std::string location) -> void { + this->college_location = std::move(location); +} + +auto College::get_college_location() -> std::string { + return this->college_location; +} + +// auto College::operator==(University) -> void { +// // compare all fields of college and university +// } + +auto College::print_pin(const University &) -> void { + std::cout << "University pin: " << this->university_pin.get_univ_pin() + << '\n'; +} diff --git a/High_School.hh b/High_School.hh new file mode 100644 index 0000000..8501456 --- /dev/null +++ b/High_School.hh @@ -0,0 +1,24 @@ +#pragma once + +#include "University.hh" + +class high_school { +private: + std::string high_school_name; + std::string high_school_location; + int high_school_rank; + double reqd_gpa_for_admit; + University university_pin; + +public: + high_school() {} + high_school(std::string, int, double); + high_school(std::string, std::string, int, double, University); + void set_high_school_name(std::string); + std::string get_high_school_name(); + void set_high_school_location(std::string); + std::string get_high_school_location(); + //......other setters and getters + void operator==(University); + void print_pin(University); +}; diff --git a/High_School_Impl.cpp b/High_School_Impl.cpp new file mode 100644 index 0000000..e69de29 diff --git a/School_Driver.cpp b/School_Driver.cpp new file mode 100644 index 0000000..93532ca --- /dev/null +++ b/School_Driver.cpp @@ -0,0 +1,9 @@ +#include "College.hh" +#include "High_School.hh" +#include "University.hh" + +auto main() -> int { + // + + return 0; +} diff --git a/Tupfile b/Tupfile new file mode 100644 index 0000000..70b4a96 --- /dev/null +++ b/Tupfile @@ -0,0 +1,8 @@ +BUILD_DIRECTORY=build +CLANG_TIDY_CHECKS='-*,bugprone-*,clang-analyzer-*,concurrency-*,cppcoreguildelines-*,llvm-*,misc-*,modernize-*,performance-*,portability-*,readability-*' +CC_FLAGS=-std=c++23 -I include -Weverything -Wno-padded -Wno-c++98-compat +CC=zig c++ + +: foreach *.cpp |> clang-tidy -checks=$(CLANG_TIDY_CHECKS) %f -- $(CC_FLAGS) |> +: foreach *.cpp |> ^j^ $(CC) $(CC_FLAGS) -c %f -o %o |> $(BUILD_DIRECTORY)/%B.o +: $(BUILD_DIRECTORY)/*.o |> $(CC) %f -o %o |> $(BUILD_DIRECTORY)/cst_136_assignment_07 diff --git a/University.hh b/University.hh new file mode 100644 index 0000000..16f86be --- /dev/null +++ b/University.hh @@ -0,0 +1,26 @@ +#pragma once + +#include + +class University { + // declare friend classes college and high_school here +private: + std::string university_name; + int university_pin; + static int pin; + +public: + University() = default; + University(const University &); + + virtual ~University() = default; + + void set_univ_pin(int upin); + int get_univ_pin(); + static void incrementPin() { pin += 1; } + + // == typical returns a boolean, and since this is under the getters section, + // I'll take it that this was meant to be for assignment. + University &operator=(const University &) = default; + virtual void print_univ_pin(); +}; diff --git a/University_Impl.cpp b/University_Impl.cpp new file mode 100644 index 0000000..c36d709 --- /dev/null +++ b/University_Impl.cpp @@ -0,0 +1,11 @@ +#include + +#include "University.hh" + +auto University::set_univ_pin(int upin) -> void { this->university_pin = upin; } + +auto University::get_univ_pin() -> int { return this->university_pin; } + +auto University::print_univ_pin() -> void { + std::cout << "University pin: " << this->university_pin << '\n'; +} diff --git a/build/College_Impl.o b/build/College_Impl.o new file mode 100644 index 0000000..a1afef7 Binary files /dev/null and b/build/College_Impl.o differ diff --git a/build/High_School_Impl.o b/build/High_School_Impl.o new file mode 100644 index 0000000..27fadb0 Binary files /dev/null and b/build/High_School_Impl.o differ diff --git a/build/School_Driver.o b/build/School_Driver.o new file mode 100644 index 0000000..c9789e5 Binary files /dev/null and b/build/School_Driver.o differ diff --git a/build/University_Impl.o b/build/University_Impl.o new file mode 100644 index 0000000..f968af4 Binary files /dev/null and b/build/University_Impl.o differ diff --git a/build/cst_136_assignment_07 b/build/cst_136_assignment_07 new file mode 100755 index 0000000..9c3d455 Binary files /dev/null and b/build/cst_136_assignment_07 differ -- cgit v1.2.3