Answer to Question #185410 in C++ for Ayla

Question #185410

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. 


1
Expert's answer
2021-04-26T07:18:25-0400
#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;
}

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