Answer to Question #240562 in C++ for Joan

Question #240562

a program that will ask for students grades in the prelim(30%), midterm(30%), and finals(40%) terms compute for the final_grade and determine whether remarks are passed or failed. passing grade is 60. print the name, grade, and remarks of the student


1
Expert's answer
2021-09-22T06:28:55-0400
#include <iostream>
using namespace std;
class Employee{
	private:
		string name;
		double salary;
		double bonus;
	public:
		void setEmployeeDetails(string n, double d){
			name = n;
			salary = d;
				if(salary<2000){
				bonus = salary * 0.5;
			}
			else if(salary>2000){
				bonus = 1500;
			}
		}
		double getBonus(){
		
		}
		void display(){
			cout<<"Name:   "<<name<<"  Salary:  "<<salary<<" pesos  Bonus: "<< bonus<<" pesos"<<endl;
		}
};
int main(){
	cout<<"Enter the number of employees\n";
	int n;
	cin>>n;
	Employee emp[n];
	cout<<"Enter the details of employees\n";
	for(int i=0; i<n; i++){
		cout<<"Employee: "<<(i+1)<<endl;
		cout<<"Enter the name of the employee\n";
		string name;
		cin>>name;
		cout<<"Enter the salary of the employee\n";
		double salary;
		cin>>salary;
		emp[i].setEmployeeDetails(name, salary);
	}
	cout<<"The employees details and their bonuses:\n";
	for(int i=0; i<n; i++){
		cout<<"Employee: "<<(i+1)<<endl;
		emp[i].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