Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1) Write a C++ program that does the following: Read and input file coordinates.txt containing the following PersonAName, PersonBName, XA,YA, XB, YB where the coordinates

1)

  • Write a C++ program that does the following:

    • Read and input file coordinates.txt containing the following

    • PersonAName, PersonBName, XA,YA, XB, YB

    • where the coordinates of PersonA in a 100 by 100 room is XA, YA

    • and the coordinates of PersonB is XB, YB.

    • Use square root function in cmath sqrt() to calculate the shortest distance between two points.

    • A file will be uploaded in this assignment that will list coordinates of two people.

    • The program should use a function call that returns the distance. If the distance is less than 6 feet, the report the case giving the names and the calculated distance.

Data fields (delete the records that are column headings or ignore it in the program). Person A Name Column 1-10 Person B Name Column 11-20 Person A X coordinate 21-23 Person A Y coordinate 25-27 Person B X coordinate 31-33 Person B Y coordinate 35-37 2)

  • In this developer exercise, design and code a C++ program that utilizes a function to calculate the following for each employee from the time record input file employeehours.txt. The employeehours will have multiple records of daily time recorded. The program should loop through the records and accumulate the hours for the employee. When a different employee is read, calculate hours * the rate of $18.00 per hour for the employee. Also calculate a 12% tax rate to be deducted from the total. Report employee name, total hours, gross pay, tax and net pay in one cout statement. You can choose any loop you think is appropriate for the requirements. Inner loop will process each record of the employee and exits the innerloop when a different employee is read. Outer loop will print the record of the calculations and reset the accumulator (hours). Outer loop is controlled by the read process and exits when there are no more records. Format of the input records is fixed and data is below. (File employeehours.txt is also attached in Blackboard). Columns 1-30 Employee name 31-32 Hours worked left justified ----+----1----+----2----+----3--- Jimmy Bucket 8 Jimmy Bucket 9 Jimmy Bucket 10 Jimmy Bucket 7 John Doe 8 John Doe 8 John Doe 8 John Doe 8 John Doe 8 Ann Doe 5 Ann Doe 5 Ann Doe 5 Ann Doe 5 Ann Doe 5 Mary Jones 4 Mary Jones 4 Mary Jones 4 Mary Jones 4 Mary Jones 4 Bob Hu 8 Bob Hu 8 Bob Hu 8 Bob Hu 8 Bob Hu 8 Sample Output: Employee: Bob Hu Total Hours:40 Gross Pay: $720.00 Tax:$86.40 Net Pay: $633.60 Submitted by: Your Name The following string functions will be useful: datarecord.substr(x,y) where x is column offset from beginning of string, and y is the number of columns. Example: name = datarecord.substr(0,30); Example 2: string datahours = datarecord.substr(31,2) stod(datahours) converts string to double

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

Database Principles Programming And Performance

Authors: Patrick O'Neil

1st Edition

1558603921, 978-1558603929

More Books

Students also viewed these Databases questions