diff --git a/201816040221/Ex03_13/Ex03_13.cpp b/201816040221/Ex03_13/Ex03_13.cpp new file mode 100644 index 0000000..7c2adfb --- /dev/null +++ b/201816040221/Ex03_13/Ex03_13.cpp @@ -0,0 +1,27 @@ +#include +//#include +using namespace std; + +#include "Invoice.h" // include definition of class Employee + +// function main begins program execution +int main() +{ + string a,b; + int x,y; + cout<<"请输入相关量"; + cin>>a; + cin>>b; + cin>>x; + cin>>y; + Invoice Invoice1(a,b,x,y); + + cout< +#include +#include +#include "Invoice.h" +using namespace std; + +Invoice::Invoice(string PN,string Pd,int sales,int price)//declar the Invoice member +{ + setInvoicePN(PN); + setInvoicePd(Pd); + setInvoicesales(sales); + setInvoiceprice(price); + +} +void Invoice::setInvoicePN(string PN)//declar the PN member +{ + InvoicePN=PN; +} +string Invoice::getInvoicePN() +{ + return InvoicePN; +} +void Invoice::setInvoicePd(string Pd)//declar the Pd member +{ + InvoicePd=Pd; +} +string Invoice::getInvoicePd() +{ + return InvoicePd; +} +void Invoice::setInvoicesales(int sales)//declar the sales memver +{ + Invoicesales=sales; +} +int Invoice::getInvoicesales() +{ + return Invoicesales; +} +void Invoice::setInvoiceprice(int price)//declar the price member +{ + Invoiceprice=price; +} +int Invoice::getInvoiceprice() +{ + return Invoiceprice; +} +int Invoice::InvoiceAmount(int sales,int price)//declar the InvoiceAmount member +{ + if(sales==0||price==0) + { + InvoiceAmount1=0; + } + else + { + InvoiceAmount1=sales*price; + } + + return InvoiceAmount1; +} diff --git a/201816040221/Ex03_13/Invoice.h b/201816040221/Ex03_13/Invoice.h new file mode 100644 index 0000000..23a6b8c --- /dev/null +++ b/201816040221/Ex03_13/Invoice.h @@ -0,0 +1,29 @@ +// Lab 3: Employee.h +// Employee class definition. + +#include // program uses C++ standard string class +using namespace std; +//#define INVOIE_H +// Employee class definition +class Invoice +{ +public://declar the three public member + + Invoice(string,string,int,int); + void setInvoicePN(string); + void setInvoicePd(string); + void setInvoicesales(int); + void setInvoiceprice(int); + string getInvoicePN(); + string getInvoicePd(); + int getInvoicesales(); + int getInvoiceprice(); + int InvoiceAmount(int,int); + +private: + string InvoicePN; + string InvoicePd; + int Invoicesales; + int Invoiceprice,InvoiceAmount; + / +}; // end class Invoice diff --git a/201816040221/Ex03_15/Date.cpp b/201816040221/Ex03_15/Date.cpp new file mode 100644 index 0000000..11c7265 --- /dev/null +++ b/201816040221/Ex03_15/Date.cpp @@ -0,0 +1,51 @@ +// Lab 3: Employee.cpp +// Employee class member-function definitions. +#include +#include +#include +#include "Date.h" +using namespace std; +Date::Date(int month,int day,int year)//declare three date members +{ + setDatemonth(month); + setDateday(day); + setDateyear(year); + +} +void Date::setDatemonth(int month)//declar the month member +{ + if(month<1||month>12) + { + Datemonth=1; + } + else + { + + + Datemonth=month; + } +} +int Date::getDatemonth() +{ + + return Datemonth; +} +void Date::setDateday(int day)//declar the day member +{ + + Dateday=day; +} +int Date::getDateday() +{ + return Dateday; +} +void Date::setDateyear(int year) +{ + Dateyear=year; +} +int Date::getDateyear() +{ + return Dateyear; +} + + diff --git a/201816040221/Ex03_15/Date.h b/201816040221/Ex03_15/Date.h new file mode 100644 index 0000000..f9bfef9 --- /dev/null +++ b/201816040221/Ex03_15/Date.h @@ -0,0 +1,29 @@ +// Lab 3: Employee.h +// Employee class definition. + +#include // program uses C++ standard string class +using namespace std; +//#define INVOIE_H +// Employee class definition +class Date +{ +public://declar the three public member + + Date(int,int,int); + void setDatemonth(int); + void setDateday(int); + void setDateyear(int); + + + int getDatemonth(); + int getDateday(); + int getDateyear(); + + +private: + int Datemonth; + int Dateday; + int Dateyear; + int dissplayDate1(); + +}; // end class date diff --git a/201816040221/Ex03_15/Ex03_15.cpp b/201816040221/Ex03_15/Ex03_15.cpp new file mode 100644 index 0000000..5a3b12d --- /dev/null +++ b/201816040221/Ex03_15/Ex03_15.cpp @@ -0,0 +1,29 @@ +// Lab 3: EmployeeTest.cpp +// Create and manipulate two Employee objects. +#include +//#include +using namespace std; + +#include "Date.h" // include definition of class Employee + +// function main begins program execution +int main() +{ + + int a,x,y; + cout<<"ÇëÊäÈëÏà¹ØÁ¿\n"; + cin>>a; + cin>>x; + cin>>y; + Date Date1(a,x,y); + + //cout<