Answer to Question #330464 in C++ for sherry

Question #330464

Develop a small application in C++ that should allow the user of application to enter the receipt number, sender name, sender address, receiver name, receiver address, shipment fee and parcel weight. After getting required information, generate a shipment receipt and show as summary on screen.

1
Expert's answer
2022-04-19T03:08:22-0400
#include <iostream>
#include <string>
using namespace std;

class Receipt
{
	int RecNum;
	string SendName;
	string SenAdress;
	string RecName;
	string RecAdress;
	float ShFee;
	float ParcWg;
public:
	Receipt(){}
	Receipt(int _RecNum, string _SendName, string _SenAdress, string _RecName,
	string _RecAdress,	float _ShFee,float _ParcWg):RecNum(_RecNum), SendName(_SendName),
	SenAdress(_SenAdress), RecName(_RecName), RecAdress(_RecAdress), ShFee(_ShFee), ParcWg(_ParcWg){}
	void Assign()
	{
		cout << "Please, enter a receipt number: ";
		cin >> RecNum;
		cout << "Please, enter a sender name: ";
		cin >> SendName;
		cout << "Please, enter a sender address: ";
		cin >> SenAdress;
		cout << "Please, enter a receiver name: ";
		cin >> RecName;
		cout << "Please, enter a receiver address: ";
		cin >> RecAdress;
		cout << "Please, enter a sheepment fee: ";
		cin >> ShFee;
		cout << "Please, enter a parcel weight: ";
		cin >> ParcWg;
	}
	void Display()
	{
		cout << "\n\tInfo about receipt:";
		cout << "\nReceipt number is " << RecNum
			<< "\nSender name is " << SendName
			<< "\nSender address is " << SenAdress
			<< "\nReceiver name is " << RecName
			<< "\nReceiver address is " << RecAdress
			<< "\nSheepment Fee is " << ShFee
			<< "\nParce weight is " << ParcWg << endl;
	}
};

int main()
{
	Receipt r(123,"Jack","5street","Bill","4Avenue",20,500);
	r.Display();
	Receipt x;
	x.Assign();
	x.Display();
}







Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS