본문내용
tring getDirector(){
return director;
}
string getActors(){
return actors;
}
void setTitle(string m_t)
{
title = m_t;
}
void setDirector(string m_d)
{
director = m_d;
}
void setActors(string m_a)
{
actors = m_a;
}
};
class Movie
{
string title;
string grade; //등급
string director;
string actors;
string genre; // 장르
public:
string getTitle(){
return title;
}
string getDirector(){
return director;
}
string getActors(){
return actors;
}
void setTitle(string m_t)
{
title = m_t;
}
void setDirector(string m_d)
{
director = m_d;
}
void setActors(string m_a)
{
actors = m_a;
}
void setGenre(string m_g)
{
genre = m_g;
}
string getGenre()
{
return genre;
}
void setGrade(string m_gr)
{
grade = m_gr;
}
string getGrade()
{
return grade;
}
};
class Movie
{
private:
string title;
string grade;
string director;
string actors;
string genre;
public:
string getTitle(){
return title;
}
string getDirector(){
return director;
}
string getActors(){
return actors;
}
void setTitle(string m_t)
{
title = m_t;
}
void setDirector(string m_d)
{
director = m_d;
}
void setActors(string m_a)
{
actors = m_a;
}
void setGenre(string m_g)
{
genre = m_g;
}
string getGenre()
{
return genre;
}
void setGrade(string m_gr)
{
grade = m_gr;
}
string getGrade()
{
return grade;
}
};
int main()
{
Movie m1;
return 0;
}
int main()
{
Movie m1;
m1.setTitle(\"Transformer\");
return 0;
}
int main()
{
Movie m1, m2, m3;
m1.setTitle(\"Transformer\");
return 0;
}
9. 직원을 나타내는 Employee 클래스를 다음의 단계에 따라서 작성하여 보자.
class Employee
{
string name;
int age;
int salary;
string years;
};
class Employee
{
private:
string name;
int age;
int salary;
int years;
public:
void setName(string u_name)
{
name = u_name;
}
void setAge(int u_age)
{
age = u_age;
}
void setSalary(int u_salary)
{
salary = u_salary;
}
void setYears(int u_years)
{
years = u_years;
}
string getName()
{
return name;
}
int getAge()
{
return age;
}
int getSalary()
{
return salary;
}
int getYears()
{
return years;
}
};
#include
#include
using namespace std;
class Employee
{
private:
string name;
int age;
int salary;
int years;
public:
void setEmployee(string n, int a, int s, int y){
name = n;
age = a;
salary = s;
years = y;
}
void setName(string u_name)
{
name = u_name;
}
void setAge(int u_age)
{
age = u_age;
}
void setSalary(int u_salary)
{
salary = u_salary;
}
void setYears(int u_years)
{
years = u_years;
}
string getName()
{
return name;
}
int getAge()
{
return age;
}
int getSalary()
{
return salary;
}
int getYears()
{
return years;
}
};
int main()
{
Employee e1;
e1.setEmployee(\"홍길동\", 26, 1000000, 1);
cout<<\"============================\"<
cout<<\"이름 : \"<
cout<<\"나이 : \"<
cout<<\"봉급 : \"<
cout<<\"년도 : \"<
cout<<\"============================\"<
}
10. 다음의 은행 업무를 기술한 문장을 읽고 클래스의 후보를 생각하여 보자.
은행, 정기예금, 보통예금, 고객
예금, 고객
예금 고객
- 계좌번호 - 이름
- 잔액 - 계좌 종류
- 이자율 - 입금
- 기간 - 출금
+기간 등록/확인 + 입급/출금
+계좌번호 등록/확인 + 계좌 종류 등록/확인
+잔액 등록/확인 + 이름 등록/확인
+이자율 설정/확인
return director;
}
string getActors(){
return actors;
}
void setTitle(string m_t)
{
title = m_t;
}
void setDirector(string m_d)
{
director = m_d;
}
void setActors(string m_a)
{
actors = m_a;
}
};
class Movie
{
string title;
string grade; //등급
string director;
string actors;
string genre; // 장르
public:
string getTitle(){
return title;
}
string getDirector(){
return director;
}
string getActors(){
return actors;
}
void setTitle(string m_t)
{
title = m_t;
}
void setDirector(string m_d)
{
director = m_d;
}
void setActors(string m_a)
{
actors = m_a;
}
void setGenre(string m_g)
{
genre = m_g;
}
string getGenre()
{
return genre;
}
void setGrade(string m_gr)
{
grade = m_gr;
}
string getGrade()
{
return grade;
}
};
class Movie
{
private:
string title;
string grade;
string director;
string actors;
string genre;
public:
string getTitle(){
return title;
}
string getDirector(){
return director;
}
string getActors(){
return actors;
}
void setTitle(string m_t)
{
title = m_t;
}
void setDirector(string m_d)
{
director = m_d;
}
void setActors(string m_a)
{
actors = m_a;
}
void setGenre(string m_g)
{
genre = m_g;
}
string getGenre()
{
return genre;
}
void setGrade(string m_gr)
{
grade = m_gr;
}
string getGrade()
{
return grade;
}
};
int main()
{
Movie m1;
return 0;
}
int main()
{
Movie m1;
m1.setTitle(\"Transformer\");
return 0;
}
int main()
{
Movie m1, m2, m3;
m1.setTitle(\"Transformer\");
return 0;
}
9. 직원을 나타내는 Employee 클래스를 다음의 단계에 따라서 작성하여 보자.
class Employee
{
string name;
int age;
int salary;
string years;
};
class Employee
{
private:
string name;
int age;
int salary;
int years;
public:
void setName(string u_name)
{
name = u_name;
}
void setAge(int u_age)
{
age = u_age;
}
void setSalary(int u_salary)
{
salary = u_salary;
}
void setYears(int u_years)
{
years = u_years;
}
string getName()
{
return name;
}
int getAge()
{
return age;
}
int getSalary()
{
return salary;
}
int getYears()
{
return years;
}
};
#include
#include
using namespace std;
class Employee
{
private:
string name;
int age;
int salary;
int years;
public:
void setEmployee(string n, int a, int s, int y){
name = n;
age = a;
salary = s;
years = y;
}
void setName(string u_name)
{
name = u_name;
}
void setAge(int u_age)
{
age = u_age;
}
void setSalary(int u_salary)
{
salary = u_salary;
}
void setYears(int u_years)
{
years = u_years;
}
string getName()
{
return name;
}
int getAge()
{
return age;
}
int getSalary()
{
return salary;
}
int getYears()
{
return years;
}
};
int main()
{
Employee e1;
e1.setEmployee(\"홍길동\", 26, 1000000, 1);
cout<<\"============================\"<
10. 다음의 은행 업무를 기술한 문장을 읽고 클래스의 후보를 생각하여 보자.
은행, 정기예금, 보통예금, 고객
예금, 고객
예금 고객
- 계좌번호 - 이름
- 잔액 - 계좌 종류
- 이자율 - 입금
- 기간 - 출금
+기간 등록/확인 + 입급/출금
+계좌번호 등록/확인 + 계좌 종류 등록/확인
+잔액 등록/확인 + 이름 등록/확인
+이자율 설정/확인
추천자료
CH10_ EXERCISE
C++ ESPRESSO(에스프레소) PART 03 - CHAPTER 13 EXERCISE(엑서사이즈) 6개
C++ ESPRESSO(에스프레소) PART 03 - CHAPTER 11 EXERCISE(엑서사이즈) 7개
C++ ESPRESSO(에스프레소) PART 03 - CHAPTER 12 PROGRAMMING(프로그래밍) 6개
C++ ESPRESSO(에스프레소) PART 03 - CHAPTER 11 PROGRAMMING(프로그래밍) 5개
C++ ESPRESSO(에스프레소) PART 02 - CHAPTER 09 PROGRAMMING(프로그래밍) 9개
C++ ESPRESSO(에스프레소) PART01 - CHAPTER 01 EXERCISE(엑서사이즈) 10개
C++ ESPRESSO(에스프레소) PART01 - CHAPTER 02 PROGRAMMING(프로그래밍) 12개
C++ ESPRESSO(에스프레소) PART01 - CHAPTER 02 EXERCISE(엑서사이즈) 6개
C++ ESPRESSO(에스프레소) PART01 - CHAPTER 02 PROGRAMMING(프로그래밍) 6개
소개글