Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C++ program called Lab3A.cpp that does the following: Using a suitable message, prompt for and read in the full name of the employee

Write a C++ program called Lab3A.cpp that does the following:

Using a suitable message, prompt for and read in the full name of the employee and save it in a string variable called name.

Note that the name can have more than one word, so you need to use the getline function.

Using a suitable message, prompt for and read in the salary of the employee and save it in a double variable called salary.

Using a suitable message, prompt for and read in the percentage rate of bonus computation and save it in an integer variable called rate. Assume the user will enter a value between 5 and 15.

Now compute the bonus earned by the employee by using the following formula:

= (/100)

and store the result in a double variable called bonus.

You must use the formula as it is provided: DO NOT remove the parenthesis and DO NOT change 100 to a floating point number such as 100.0 or 100.00 (and so

on).

Finally display the result in the following format:

Employee_name earned a bonus of XXXX.XX

Employee_name must be replaced by the name entered by the user, and

XXXX.XX must be replaced by the bonus computed by your program.

If you used the formula as it is, you probably got 0 as the bonus. Think why?

HINT: Integer Division and Typecasting.

Fix your code to get the correct bonus value by using the static_cast function.

Make sure you display exactly two numbers after the decimal point.

B. If-Else

Write a program to ask the user to enter a number between 200 and 300, inclusive.

Check whether the entered number is in the provided range

a. If the user-entered number is outside the range, display an error message

saying that the number is outside the range.

b. If the user-entered number is within a range

i. Generate a seeded random number in the range of 200 to 300,

inclusive.

ii. Display the randomly generated number with a suitable message.

iii. Check if the generated number is equal to, or greater than, or less

than the user entered number. You can implement this using either

multiple branches (using else if) or a nested if-else.

iv. Inform the user with a suitable message

C. More if-else

In this program, you MUST use the C-style printf/scanf functions to write/read.

You need to compute the bonus for a salesperson based on the following conditions.

The minimum bonus is 100.00, irrespective of the amount of sales.

If the number of years of experience is >= 10 years, the bonus is 3% of the

sales, otherwise it is 2% of the sales.

If the amount of sales if over $100000.00, there is additional bonus of $500.00

Write a program that inputs the total amount of sales by a salesperson and compute their bonus. Then display the computed bonus with a suitable message. There must be EXACTLY 2 numbers after the decimal point and a $ sign in front of the bonus value.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Main Memory Database Systems

Authors: Frans Faerber, Alfons Kemper, Per-Åke Alfons

1st Edition

1680833243, 978-1680833249

More Books

Students also viewed these Databases questions

Question

=+ (a) Prove that I()(t)= fox'-1(log x)*e * dx.

Answered: 1 week ago

Question

Analyze the impact of labor unions on health care.

Answered: 1 week ago

Question

Assess three motivational theories as they apply to health care.

Answered: 1 week ago

Question

Discuss the history of U.S. labor unions.

Answered: 1 week ago