write the flowchart and c++ program in which the user enters their salary and their age. if the person is over 75, increase their salary by 10% of their salary. Otherwise, increase their salary by 5% of their salary. Display the new salary in either case. Using selection.
#include <iostream>
using namespace std;
int main()
{
int age = 0;
double salary = 0;
while (true)
{
cout << "Enter employee's age: ";
cin >> age;
if (age >= 18 && age <= 100) break;
cout << "Wrong age!" << endl;
}
while (true)
{
cout << "Enter employee's salary: ";
cin >> salary;
if (salary > 0) break;
cout << "Wrong salary!" << endl;
}
if (age > 75) cout << "New salary for employee is (+10%): " << salary * 1.1 << endl;
else cout << "New salary for employee is (+5%): " << salary * 1.05 << endl;
return 0;
}
Comments
Leave a comment