/
source.cpp
94 lines (71 loc) · 2.84 KB
/
source.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
// Kevin Mangan
// CSII Inheritance Lab
// source.cpp
#include <iostream>
#include <string>
#include "Package.h"
#include "TwoDayPackage.h"
#include "OverNightPackage.h"
using namespace std;
int TwoDayPackage::calculateCost(){
return ounces*costPerOunce+flatFee;
}
void TwoDayPackage::print(){
int cost = calculateCost();
cout << "\n\tHere is your receipt: " << endl << endl << endl;
cout << "\n\t\tSender Name: " << sName << endl;
cout << "\n\t\tSender Address: " << sAddress << endl;
cout << "\n\t\tSender City " << sCity << endl;
cout << "\n\t\tSender State: " << sState << endl;
cout << "\n\t\tSender Zip Code: " << sZip << endl << endl;
cout << "\n\t\tRecipient Name: " << rName << endl;
cout << "\n\t\tRecipient Address: " << rAddress << endl;
cout << "\n\t\tRecipient City " << rCity << endl;
cout << "\n\t\tRecipient State: " << rState << endl;
cout << "\n\t\tRecipient Zip Code: " << rZip << endl << endl;
cout << "\n\t\tPackage weight: " << ounces << " ounces" << endl;
cout << "\n\t\tPackage cost: $" << cost << endl;
}
int OverNightPackage::calculateCost(){
return (ounces*costPerOunce)+(additionalFee*ounces);
}
void OverNightPackage::print(){
int cost = calculateCost();
cout << "\n\tHere is your receipt: " << endl << endl << endl;
cout << "\n\t\tSender Name: " << sName << endl;
cout << "\n\t\tSender Address: " << sAddress << endl;
cout << "\n\t\tSender City " << sCity << endl;
cout << "\n\t\tSender State: " << sState << endl;
cout << "\n\t\tSender Zip Code: " << sZip << endl << endl;
cout << "\n\t\tRecipient Name: " << rName << endl;
cout << "\n\t\tRecipient Address: " << rAddress << endl;
cout << "\n\t\tRecipient City " << rCity << endl;
cout << "\n\t\tRecipient State: " << rState << endl;
cout << "\n\t\tRecipient Zip Code: " << rZip << endl << endl;
cout << "\n\t\tPackage weight: " << ounces << " ounces" << endl;
cout << "\n\t\tPackage cost: $" << cost << endl;
}
void TwoDayPackage::setData(string sNamee, string sAddresss, string sCityy, string sStatee, string sZipp, string rNamee, string rAddresss, string rCityy, string rStatee, string rZipp){
sName = sNamee;
sAddress = sAddresss;
sCity = sCityy;
sState = sStatee;
sZip = sZipp;
rName = rNamee;
rAddress = rAddresss;
rCity = rCityy;
rState = rStatee;
rZip = rZipp;
}
void OverNightPackage::setData(string sNamee, string sAddresss, string sCityy, string sStatee, string sZipp, string rNamee, string rAddresss, string rCityy, string rStatee, string rZipp){
sName = sNamee;
sAddress = sAddresss;
sCity = sCityy;
sState = sStatee;
sZip = sZipp;
rName = rNamee;
rAddress = rAddresss;
rCity = rCityy;
rState = rStatee;
rZip = rZipp;
}