Answer to Question #263862 in C++ for Aashi

Question #263862

Write a program that would print the information (nume, year of joining. salary, address) of three employees by creating a class named 'Employee




The output should be as follows:




Name Year of joining Address



Roma. 1994. 64C, Jaipur



Ramya. 2000. 68D-Udaipur



Teena. 1999. 26B-Kota

1
Expert's answer
2021-11-12T17:37:31-0500
#include<iostream>
using namespace std;
class Employee{
	public:
		string name;
		int year;
		int salary;
		int address;
void getDetails(){
	for(int i=1;i<=3;i++){
	cout<<"\nStudent "<<i<<" details"<<endl;
	cout<<"Enter the name of the student: ";
	cin>>name;
	cout<<"Enter the year you joined: ";
	cin>>year;
	cout<<"Enter the salary: ";
	cin>>salary;
	cout<<"Enter the address: "<<endl;
	cin>>address;}
}
void display(){
	for(int i=1;i<=3;i++){
		cout<<"Displaying student "<<i<<" details"<<endl;
	    cout<<name<<", "<<year<<", "<<address<<endl;
}
}
};
int main()
{
	Employee E;
	E.getDetails();
	E.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