Answer to Question #159295 in C++ for Kefilwe Mamabolo

Question #159295

A certain company wants to give their employees an increase based on their years’ of 

experience and position

Years experience Position Increase

< 10 M 7.5%

< 10 S 5.5%

< 10 P 4.5%

>= 10 < 15 M 12.5%

>= 10 < 15 S 9.25%

>= 10 < 15 P 7.75%

>=15 M 15%

>=15 S 11.25%

>=15 P 9.75%

Do all the necessary planning to solve this problem:

4.1 Plan all the variables needed (description, input, output)

4.2 Draw the IPO-chart

4.3 Write the algorithm using a nested-if statement.

4.4 Write a corresponding C++ code (See Figure 4.1 and Figure 4.2).


1
Expert's answer
2021-01-28T09:52:34-0500

4.1-4.2)



4.3)

if ((experience < 10) && (position == 'M'))

{

increase = 7.5;

}

else if ((experience < 10) && (position == 'S'))

{

increase = 5.5;

}

else if ((experience < 10) && (position == 'P'))

{

increase = 4.5;

}

else if ((experience >= 10) && (position == 'M')&&(experience < 15))

{

increase = 12.5;

}

else if ((experience >= 10) && (position == 'S') && (experience < 15))

{

increase = 9.25;

}

else if ((experience >= 10) && (position == 'P') && (experience < 15))

{

increase = 7.75;

}

else if ((experience >= 15) && (position == 'M'))

{

increase = 15;

}

else if ((experience >= 15) && (position == 'S'))

{

increase = 11.25;

}

else if ((experience >= 15) && (position == 'P'))

{

increase = 9.75;

}

4.4) #include <iostream>
using namespace std;
int main()
{
	int experience;
	char position;
	float increase;
	cout << "Enter the work experience: ";
	cin >> experience;
	cout << "Enter the position: ";
	cin >> position;
	if ((experience < 10) && (position == 'M'))
	{
		increase = 7.5;
	}
	else if ((experience < 10) && (position == 'S'))
	{
		increase = 5.5;
	}
	else if ((experience < 10) && (position == 'P'))
	{
		increase = 4.5;
	}
	else if ((experience >= 10) && (position == 'M')&&(experience < 15))
	{
		increase = 12.5;
	}
	else if ((experience >= 10) && (position == 'S') && (experience < 15))
	{
		increase = 9.25;
	}
	else if ((experience >= 10) && (position == 'P') && (experience < 15))
	{
		increase = 7.75;
	}
	else if ((experience >= 15) && (position == 'M'))
	{
		increase = 15;
	}
	else if ((experience >= 15) && (position == 'S'))
	{
		increase = 11.25;
	}
	else if ((experience >= 15) && (position == 'P'))
	{
		increase = 9.75;
	}
	cout << "For employees " << position << " with experience " << experience << " increase: " << increase << 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