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
#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();
}
}
Comments
Leave a comment