Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

- Write a C++ program that prompts the user for a set of integers. I should enter them one at a time, pressing enter between

- Write a C++ program that prompts the user for a set of integers. I should enter them one at a time, pressing enter between each one, and once I enter 0, the program should then find and print the sum of the even integers and print out the sum of the odd integers. For example, something like this:

Enter an integer (enter 0 to stop): 14 Enter an integer (enter 0 to stop): 3 Enter an integer (enter 0 to stop): 3 Enter an integer (enter 0 to stop): 12 Enter an integer (enter 0 to stop): 0 The sum of the even integers is: 26 The sum of the odd integers is: 6

- Write a C++ program that prompts the user to input a positive integer. It should then output a message indicating whether the number is a prime number.

(Note: 1 is not a prime number.An even number is prime if it is 2. Any other integer is prime if it is not divisible by any other integer other than 1 or its value.For example, 17 in prime, but 15 is not.Note, determining if a very large number is prime is very hard.So for this exercise, it is OK to assume your candidate numbers are less than 20,000.

The following employees in a company are up for a special pay increase. You are given a file, say EmployeeData.txt, with the following data:

Miller Andrew 65789.87 5

Green Sheila 75892.56 6

Sethi Amit 74900.50 6.1

Hooks Alex 66345.45 7.2

Miller Maria 75345.50 6.7

Harrison Marga 80450.95 5.5

Each input line consists of an employees last name, first name, current salary, and percent pay increase. For example, in the first input line, the last name of the employee is Miller, the first name is Andrew, the current salary is 65789.87, and the pay increase is 5%.

- Write a C++ program that reads data from the specified file and stores the output in the file EmployeeOutput.dat. If the percent pay increase is greater than or equal to 6%, then add $1000.00 to the updated salary.For each employee, the data must be output in the following form:firstNamelastName updatedSalary.Format the output of decimal numbers to two decimal places.Make sure you use a while loop to read until EOF.Your program should work if I change the number of lines in the input file.Your program should also be able to handle a case where the final line of the file is empty, a common error here is that you will read and process the last real line of data twice!

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_2

Step: 3

blur-text-image_3

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

The Database Relational Model A Retrospective Review And Analysis

Authors: C. J. Date

1st Edition

0201612941, 978-0201612943

More Books

Students also viewed these Databases questions

Question

Explain the importance of nonverbal messages.

Answered: 1 week ago

Question

Describe the advantages of effective listening.

Answered: 1 week ago

Question

Prepare an employment application.

Answered: 1 week ago