From c13354cca889531b91ee53104117cdaf4b337d6b Mon Sep 17 00:00:00 2001 From: 201816040103 <56601097+201816040103@users.noreply.github.com> Date: Fri, 1 Nov 2019 12:49:36 +0800 Subject: [PATCH 01/12] Create Invoice.h --- 201816040103/Ex03_13/Invoice.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 201816040103/Ex03_13/Invoice.h diff --git a/201816040103/Ex03_13/Invoice.h b/201816040103/Ex03_13/Invoice.h new file mode 100644 index 0000000..9cf42e4 --- /dev/null +++ b/201816040103/Ex03_13/Invoice.h @@ -0,0 +1,22 @@ +#include +using namespace std; + +class Invoice +{ +public: + Invoice(string,string,int,int); + void setPno(string); + string getPno(); + void setPnoDescribe(string); + string getPnoDescribe(); + void setA(int); + int getA(); + void setB(int); + int getB(); + int getInvoiceAmount(); +private: + string pno; + string pnodescribe; + int a; + int b; +}; From 6af57d687e14ff1da6b7b8ff7742cb838b1769cd Mon Sep 17 00:00:00 2001 From: 201816040103 <56601097+201816040103@users.noreply.github.com> Date: Fri, 1 Nov 2019 12:50:21 +0800 Subject: [PATCH 02/12] Create Date.h --- 201816040103/Ex03_15/Date.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 201816040103/Ex03_15/Date.h diff --git a/201816040103/Ex03_15/Date.h b/201816040103/Ex03_15/Date.h new file mode 100644 index 0000000..e2dfde3 --- /dev/null +++ b/201816040103/Ex03_15/Date.h @@ -0,0 +1,18 @@ +using namespace std; + +class Date +{ +public: + Date(int ,int ,int ); + void setMonth(int); + int getMonth(); + void setDay(int); + int getDay(); + void setYear(int); + int getYear(); + int getdisplayDate(); +private: + int month; + int day; + int year; +}; From 4a6df61b461d3c1f7c190b28035b94d09dfb00c7 Mon Sep 17 00:00:00 2001 From: 201816040103 <56601097+201816040103@users.noreply.github.com> Date: Fri, 1 Nov 2019 12:51:55 +0800 Subject: [PATCH 03/12] Create Invoice.cpp --- 201816040103/Ex03_13/Invoice.cpp | 63 ++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 201816040103/Ex03_13/Invoice.cpp diff --git a/201816040103/Ex03_13/Invoice.cpp b/201816040103/Ex03_13/Invoice.cpp new file mode 100644 index 0000000..b1f7eb9 --- /dev/null +++ b/201816040103/Ex03_13/Invoice.cpp @@ -0,0 +1,63 @@ +#include +#include"Invoice.h" +using namespace std; + +Invoice::Invoice(string pnol,string pnodescribel,int al,int bl) +{ + setPno(pnol); + setPnoDescribe(pnodescribel); + setA(al); + setB(bl); +} + +void Invoice::setPno(string pnol) +{ + pno = pnol; +} + +string Invoice::getPno() +{ + return pno; +} + +void Invoice::setPnoDescribe(string pnodescribel) +{ + pnodescribe = pnodescribel; +} + +string Invoice::getPnoDescribe() +{ + return pnodescribe; +} + +void Invoice::setA(int al) +{ + if(al > 0) + a = al; + else + a = 0; +} + +int Invoice::getA() +{ + return a; +} + +void Invoice::setB(int bl) +{ + if(bl > 0) + b = bl; + else + b = 0; +} + +int Invoice::getB() +{ + return b; +} + +int Invoice::getInvoiceAmount() +{ + return getA()*getB(); +} + From 84f605f7f7055f90784233fe66b628ed0c759cc6 Mon Sep 17 00:00:00 2001 From: 201816040103 <56601097+201816040103@users.noreply.github.com> Date: Fri, 1 Nov 2019 12:52:42 +0800 Subject: [PATCH 04/12] Create Ex03_13.cpp --- 201816040103/Ex03_13/Ex03_13.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 201816040103/Ex03_13/Ex03_13.cpp diff --git a/201816040103/Ex03_13/Ex03_13.cpp b/201816040103/Ex03_13/Ex03_13.cpp new file mode 100644 index 0000000..d3d8854 --- /dev/null +++ b/201816040103/Ex03_13/Ex03_13.cpp @@ -0,0 +1,18 @@ +#include +using namespace std; + +#include "Invoice.cpp" +int main() +{ + Invoice Invoice1("A01","Well",10,15); + Invoice Invoice2("A02","Well",-1,15); + Invoice Invoice3("A03","Well",10,-1); + cout<<"The Invoice1 is "< Date: Fri, 1 Nov 2019 12:53:38 +0800 Subject: [PATCH 05/12] Create Date.cpp --- 201816040103/Ex03_15/Date.cpp | 50 +++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 201816040103/Ex03_15/Date.cpp diff --git a/201816040103/Ex03_15/Date.cpp b/201816040103/Ex03_15/Date.cpp new file mode 100644 index 0000000..1b99bd0 --- /dev/null +++ b/201816040103/Ex03_15/Date.cpp @@ -0,0 +1,50 @@ +#include + +#include "Date.h" + +using namespace std; + +Date::Date(int monthl,int dayl,int yearl) +{ + setMonth(monthl); + setDay(dayl); + setYear(yearl); +} + +void Date::setMonth(int monthl) +{ + if(monthl > 0 && monthl < 13 ) + month = monthl; + else + month = 1; +} + +int Date::getMonth() +{ + return month; +} + +void Date::setDay(int dayl) +{ + day = dayl; +} + +int Date::getDay() +{ + return day; +} + +void Date::setYear(int yearl) +{ + year = yearl; +} + +int Date::getYear() +{ + return year; +} + +int Date::getdisplayDate() +{ + cout<<"The Date is "< Date: Fri, 1 Nov 2019 12:54:13 +0800 Subject: [PATCH 06/12] Create Ex03_15.cpp --- 201816040103/Ex03_15/Ex03_15.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 201816040103/Ex03_15/Ex03_15.cpp diff --git a/201816040103/Ex03_15/Ex03_15.cpp b/201816040103/Ex03_15/Ex03_15.cpp new file mode 100644 index 0000000..28260a1 --- /dev/null +++ b/201816040103/Ex03_15/Ex03_15.cpp @@ -0,0 +1,14 @@ +#include + +#include "Date.h" + +using namespace std; + +int main() +{ + Date Date1(11,4,2019); + Date Date2(15,4,2019); + + Date1.getdisplayDate(); + Date2.getdisplayDate(); +} From 0b578a92b32094975e8a0eed8bcc2225f8902a04 Mon Sep 17 00:00:00 2001 From: 201816040103 <56601097+201816040103@users.noreply.github.com> Date: Fri, 1 Nov 2019 14:12:07 +0800 Subject: [PATCH 07/12] Create Invoice.cpp --- 201816040107/Ex03_13/Invoice.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 201816040107/Ex03_13/Invoice.cpp diff --git a/201816040107/Ex03_13/Invoice.cpp b/201816040107/Ex03_13/Invoice.cpp new file mode 100644 index 0000000..c34153f --- /dev/null +++ b/201816040107/Ex03_13/Invoice.cpp @@ -0,0 +1,21 @@ +#include +using namespace std; +class Invoice +{ + public: + Invoice(string,string,int,int);//构造函数; + void setnumber(string); + string getnumber(); + void setdes(string); + string getdes(); + void setamount(int); + int getamount(); + void setprice(int); + int getprice(); + int getInvoiceAmount(int,int); + private: + string number;//零件号; + string des;//零件描述; + int amount;//零件数量; + int price; //零件单价; +}; From 1a358280d18ad726a465196470d5770cc259da87 Mon Sep 17 00:00:00 2001 From: 201816040103 <56601097+201816040103@users.noreply.github.com> Date: Fri, 1 Nov 2019 14:14:34 +0800 Subject: [PATCH 08/12] Create Ex03_13.cpp --- 201816040107/Ex03_13/Ex03_13.cpp | 34 ++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 201816040107/Ex03_13/Ex03_13.cpp diff --git a/201816040107/Ex03_13/Ex03_13.cpp b/201816040107/Ex03_13/Ex03_13.cpp new file mode 100644 index 0000000..fdf7b3c --- /dev/null +++ b/201816040107/Ex03_13/Ex03_13.cpp @@ -0,0 +1,34 @@ +#include +#include +#include "Invoice.cpp" +using namespace std; +int main() +{ + Invoice v1("a1","apple",100,5); + Invoice v2("a2","car",5,30); + cout<>a1>>a2>>a3>>a4;//对对象v1中的四个数据成员重新进行赋值; + cin>>a5>>a6>>a7>>a8;//对对象v2中的四个数据成员重新进行赋值; + v1.setnumber(a1); + v1.setdes(a2); + v1.setamount(a3); + v1.setprice(a4); + cout< Date: Fri, 1 Nov 2019 18:57:14 +0800 Subject: [PATCH 09/12] Create Invoice.h --- 201816040107/Ex03_13/Invoice.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 201816040107/Ex03_13/Invoice.h diff --git a/201816040107/Ex03_13/Invoice.h b/201816040107/Ex03_13/Invoice.h new file mode 100644 index 0000000..c34153f --- /dev/null +++ b/201816040107/Ex03_13/Invoice.h @@ -0,0 +1,21 @@ +#include +using namespace std; +class Invoice +{ + public: + Invoice(string,string,int,int);//构造函数; + void setnumber(string); + string getnumber(); + void setdes(string); + string getdes(); + void setamount(int); + int getamount(); + void setprice(int); + int getprice(); + int getInvoiceAmount(int,int); + private: + string number;//零件号; + string des;//零件描述; + int amount;//零件数量; + int price; //零件单价; +}; From 8749a1ab18c68c1f1d0cc5d4f92ff285913cc1fd Mon Sep 17 00:00:00 2001 From: 201816040103 <56601097+201816040103@users.noreply.github.com> Date: Fri, 1 Nov 2019 18:59:14 +0800 Subject: [PATCH 10/12] Create Ex03_15.cpp --- 201816040107/Ex03_15/Ex03_15.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 201816040107/Ex03_15/Ex03_15.cpp diff --git a/201816040107/Ex03_15/Ex03_15.cpp b/201816040107/Ex03_15/Ex03_15.cpp new file mode 100644 index 0000000..ee7070f --- /dev/null +++ b/201816040107/Ex03_15/Ex03_15.cpp @@ -0,0 +1,15 @@ +#include +#include "Date.h" +using namespace std; +int main() +{ + Date w1(2018,12,20);//定义对象w1; + w1.displayDate(12); + int q1,q2,q3; + cout<<"请输入年月日:"; + cin>>q1>>q2>>q3; + w1.setyear(q1); + w1.setmonth(q2); + w1.setdate(q3); + w1.displayDate(q2); +} From a17879fa8af565611466cc2aa1fce2ed18ff1b4c Mon Sep 17 00:00:00 2001 From: 201816040103 <56601097+201816040103@users.noreply.github.com> Date: Fri, 1 Nov 2019 18:59:46 +0800 Subject: [PATCH 11/12] Create Date.cpp --- 201816040107/Ex03_15/Date.cpp | 42 +++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 201816040107/Ex03_15/Date.cpp diff --git a/201816040107/Ex03_15/Date.cpp b/201816040107/Ex03_15/Date.cpp new file mode 100644 index 0000000..5ad4954 --- /dev/null +++ b/201816040107/Ex03_15/Date.cpp @@ -0,0 +1,42 @@ +#include +#include +#include "Date.h" +using namespace std; +Date::Date(int n1,int n2,int n3) + :year(n1),month(n2),date(n3)//初始化; +{ + +} +void Date::setyear(int a1) +{ + year=a1; +} +int Date::getyear() +{ + return year; +} +void Date::setmonth(int a2) +{ + month=a2; +} +int Date::getmonth() +{ + return month; +} +void Date::setdate(int a3) +{ + date=a3; +} +int Date::getdate() +{ + return date; +} +void Date::displayDate(int a2)//displayDate函数的定义; +{ + if(a2<=12 && a2>=1) + { + cout< Date: Fri, 1 Nov 2019 19:00:17 +0800 Subject: [PATCH 12/12] Create Date.h --- 201816040107/Ex03_15/Date.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 201816040107/Ex03_15/Date.h diff --git a/201816040107/Ex03_15/Date.h b/201816040107/Ex03_15/Date.h new file mode 100644 index 0000000..ae5cb94 --- /dev/null +++ b/201816040107/Ex03_15/Date.h @@ -0,0 +1,18 @@ +#include +using namespace std; +class Date +{ + public: + Date(int, int,int);//申明构造函数; + void setyear(int); + int getyear(); + void setmonth(int); + int getmonth(); + void setdate(int); + int getdate(); + void displayDate(int); + private: + int date;//日; + int month;//月; + int year;//年; +};