Answer to Question #231238 in C++ for Billu

Question #231238
Provide an improved declaration for the Customer class that exploits the principles of reusability. Provide the interface only. (b) Implement the constructor for the derived Customer class. (c) Consider the partial class declaration of an Employee class below: class Employee: protected Person{ public: //... double Rate; double GetRate() const; double GetHours() const; private: double Hours; //... protected: double Pay() const; //... }; (i) The code fragment below (extracted from a main() function) has three invalid statements. Write down the line numbers of the invalid statements and explain why each of these statements is invalid. E is an instance of an Employee object.
1
Expert's answer
2021-08-30T17:59:21-0400
#include<iostream>
using namespace std;
class Customer{
	private:
		string name;
		int custID;
	public:
		Customer(){
			
		}
		Customer(string n, int id){
			name = n;
			custID = id;
		}
		void input(){
			cout<<"Enter customer name\n";
			cin>>name;
			cout<<"Enter customer id\n";
			cin>>custID;
		}
		void display(){
			cout<<"The customer name is:  "<<name;
			cout<<"\nThe customer id is:  "<<custID;
		}
		
};
int main(){
	Customer c;
	c.input();
	c.display();
}


The code fragment is not provided as instructed in the question. 
The question is not complete 
class Employee: protected Person{ 
public:
 
 double Rate; 
 double GetRate() const;
 double GetHours() const;
  private: double Hours; 
  protected: double Pay() const;
  }
  int main(){
  	
  }

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