Commit bb957e73 authored by Michael's avatar Michael

michael.davityan:exercise_03_11

parent f76d10af
#include "Gradebook.hpp"
#include <iostream>
#include <string>
GradeBook::GradeBook(std::string courseName, std::string teacherName)
{
setCourseName(courseName);
setTeacherName(teacherName);
}
void
GradeBook::setCourseName(std::string courseName)
{
courseName_ = courseName;
}
void
GradeBook::setTeacherName(std::string teacherName)
{
teacherName_ = teacherName;
}
std::string
GradeBook::getCourseName()
{
return courseName_;
}
std::string
GradeBook::getTeacherName()
{
return teacherName_;
}
void
GradeBook::displayMessage()
{
std::cout << "Welcome to the grade book for\n" << getCourseName() << "!" << "\n"
<< "This course is presented by: " << getTeacherName() << std::endl;
}
#include <string>
class GradeBook
{
public:
GradeBook(std::string courseName, std::string teacherName);
void setCourseName(std::string courseName);
void setTeacherName(std::string teacherName);
std::string getCourseName();
std::string getTeacherName();
void displayMessage();
private:
std::string courseName_;
std::string teacherName_;
};
#include "Gradebook.hpp"
#include <iostream>
#include <string>
int
main()
{
std::string courseName;
std::string teacherName;
std::cout << "Insert course name: ";
std::getline(std::cin, courseName);
std::cout << "Insert teacher name: ";
std::getline(std::cin, teacherName);
GradeBook gradeBook1(courseName, teacherName);
gradeBook1.displayMessage();
std::cout << "Insert course name: ";
std::getline(std::cin, courseName);
std::cout << "Insert teacher name: ";
std::getline(std::cin, teacherName);
GradeBook gradeBook2(courseName, teacherName);
gradeBook2.displayMessage();
return 0;
}
Gradebook: exercise_03_11.o Gradebook.o .gitignore
g++ exercise_03_11.o Gradebook.o -o Gradebook
exercise_03_11.ii: exercise_03_11.cpp Gradebook.hpp
g++ -E exercise_03_11.cpp -o exercise_03_11.ii
Gradebook.ii: Gradebook.cpp Gradebook.hpp
g++ -E Gradebook.cpp -o Gradebook.ii
exercise_03_11.s: exercise_03_11.ii
g++ -S exercise_03_11.ii -o exercise_03_11.s
Gradebook.s: Gradebook.ii
g++ -S Gradebook.ii -o Gradebook.s
exercise_03_11.o: exercise_03_11.s
g++ -c exercise_03_11.s -o exercise_03_11.o
Gradebook.o: Gradebook.s
g++ -c Gradebook.s -o Gradebook.o
.gitignore:
echo Gradebook > .gitignore
clean:
rm -f *.ii *.s *.o *.out Gradebook .gitignore
test1: Gradebook
./Gradebook < test1.in > test1.out || echo "Test 1 is executing..."
diff test1.out test1.expected && echo PASSED || echo FAILED
.PRECIOUS: main.ii main.s
.SECONDARY: main.ii main.s
Insert course name: Insert teacher name: Welcome to the grade book for
C++ by Andrew Scott.!
This course is presented by: Artur Setraqyan.
Insert course name: Insert teacher name: Welcome to the grade book for
Java Script by Tom Hawkins.!
This course is presented by: Armen Danielyan.
C++ by Andrew Scott.
Artur Setraqyan.
Java Script by Tom Hawkins.
Armen Danielyan.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment