Skip to content

Commit f022202

Browse files
committed
all finished
1 parent 0eac59c commit f022202

File tree

4 files changed

+34
-3
lines changed

4 files changed

+34
-3
lines changed

assign1/main.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ void parse_csv(std::string filename, std::vector<Course> &courses) {
9595
* This vector will be modified by removing all offered courses.
9696
*/
9797
void write_courses_offered(std::vector<Course> &all_courses) {
98-
/* (STUDENT TODO) Your code goes here... */
9998
std::ofstream ofs(COURSES_OFFERED_PATH);
10099
std::vector<Course> not_offered;
101100
if(ofs.is_open()) {

assign3/class.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#include "class.h"
2+
3+
bool Student::check_score() {
4+
if(this->score > 100) return false;
5+
return true;
6+
}
7+
8+
void Student::setdata(int score) {
9+
change_name("tommy");
10+
this->score = score;
11+
}
12+
13+
void Student::change_name(std::string name) {
14+
this->name = name;
15+
}
16+
17+
int Student::get_data() const {
18+
return score;
19+
}

assign3/class.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#include<string>
2+
class Student {
3+
public:
4+
Student(): score(0), name("") {}
5+
Student(int score, std::string name): score(score), name(name) {}
6+
int get_data() const;
7+
void setdata(int score);
8+
private:
9+
bool check_score();
10+
void change_name(std::string name);
11+
int score;
12+
std::string name;
13+
};

assign3/main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
* CS106L Assignment 3: Make a Class
33
* Created by Fabio Ibanez with modifications by Jacob Roberts-Baca.
44
*/
5-
5+
#include "class.h"
66
/* #### Please don't change this line! #### */
77
int run_autograder();
88

99
int main() {
1010
// STUDENT TODO: Construct an instance of your class!
11-
11+
Student tommy(100, "tommy");
1212
/* #### Please don't change this line! #### */
1313
return run_autograder();
1414
}

0 commit comments

Comments
 (0)