Get 20% Off + $20 Signup Bonus ! Limited Time, Hurry !
Get 20% Off + $20 Signup Bonus ! Limited Time, Hurry !
Securing Higher Grades Costing Your Pocket? Book Your Assignment at The Lowest Price Now!
loader
Add File

Error goes here

Files Missing!

Please upload all relevant files for quick & complete assistance.

Stuck on Your Question?

Get 24x7 live help from our Top Tutors. All subjects covered.

loader
250 words

Error goes here

Files Missing!

Please upload all relevant files for quick & complete assistance.

Students Who Viewed This Also Studied

9 Pages
ITAP2005 Java Programming Fundamentals

Questions: Write a program that reads in the radius and length of a cylinder and computes the area and volume using the following formulas. area = radius * radius * π volume = area * length ...

Course

ITAP2005

Subject

Programing

University

Victorian Institute of technology

1 Page
Management

create and apply a digital signature against man-in-the middle (encryption & security) I need coding ...

Type

Programming

Subject

Programing

26 Pages
CSI218 Data Structures and Algorithms

Question: Project 1: Operashun You will complete a C++ program that implements a simplified version of a classic kids’ game in which each player tries to remove body parts from a patient. G ...

Course

CSI218

Subject

Programing

University

Quincy College

15 Pages
CS107 C++ Programming

Questions: Camera intrinsics and extrinsics For this project, you need to achieve 3D navigation on a static 2D image by using camera intrinsics and extrinsics. Given a pair of color and depth image ...

Course

CS107

Type

Programming

Subject

Programing

University

Saylor Academy

Season

Fall

C++ Application

Question

Answered

Task
Create a C++ application which will read a file of daily payments, calculate the total as well as the average
payment, display the results to the screen and write the results to a file. The input and output file names
should be provided as command line arguments.
task_3.cpp
The task_3.cpp file holds the main() function which is responsible for the following functionality:
Extracts the input file name and output file name from the command line arguments.
o If the number of command line arguments is not correct, throw an exception. The exception
class is Argc_error : public logic_error.
o The exception handler should display a prompt for the correct usage and exit. Please use
the same phrasing shown in the sample runs below.
Calls the appropriate openFile() function (see description below) to open the relevant files. If the file
name returned by openFile() is different from the one originally specified in the command line,
require the user to confirm to proceed with processing or to quit. Please use the prompts shown in
the sample runs provided below.
Reads the input file line by line, and extracts the relevant payment.
o Check if the extracted payments are valid. Throw an exception if the payment is not a
number – all characters are digits from 0‐9. The exception class for errors is Digit_error :
public logic_error.
o If the payment is not valid, the exception handler will skip the line, and display a message.
Please use the same error messages shown in the sample runs below.
o A sample input data file, data.txt, is shown below and provided in your A3 zip file. Each line
has the first 40 char for the name, then 10 char space for the payment, and the rest of the
line for comments.
Calculates the total as well as the average payment. Writes the results to the output file and
displays it to the screen.
o See the sample runs below for the expected output for the data.txt file provided.
The task_3.cpp file also contains two openFile() functions, one each to open the input and output files. Each
openFile() function should provide the following functionality:
Attempts to open the passed in file name.
If there is an error when opening the provided file name the function should throw an exception,
passing whatever information is required to the exception handler. Please use the error messages
shown in the sample runs below.
The exception handler should display an appropriate error message and prompt the user to provide
a new file name, again please use the prompts shown in the sample runs below. The exception
handler should then recursively call openFile() passing the new file name. The openFile() function
will continue to be recursively called until a file is successfully opened. In practice you would put a
limit on the number of potential calls, in order to avoid infinite recursion. For this assignment please
disregard this problem.
The relevant exception class for the two openFile() functions are shown below.
o string openFile(ifstream& in, string str): Input file exception class is Readfile_error : public
logic_error.
o string openFile(ofstream& out, string str): Output file Exception class is Writefile_error : public
logic_error.
Return the name of the opened file.

C++ Application

Answer in Detail

Solved by qualified expert

Get Access to This Answer

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Hac habitasse platea dictumst vestibulum rhoncus est pellentesque. Amet dictum sit amet justo donec enim diam vulputate ut. Neque convallis a cras semper auctor neque vitae. Elit at imperdiet dui accumsan. Nisl condimentum id venenatis a condimentum vitae sapien pellentesque. Imperdiet massa tincidunt nunc pulvinar sapien et ligula. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere. Et ultrices neque ornare aenean euismod. Suscipit tellus mauris a diam maecenas sed enim. Potenti nullam ac tortor vitae purus faucibus ornare. Morbi tristique senectus et netus et malesuada. Morbi tristique senectus et netus et malesuada. Tellus pellentesque eu tincidunt tortor aliquam. Sit amet purus gravida quis blandit. Nec feugiat in fermentum posuere urna. Vel orci porta non pulvinar neque laoreet suspendisse interdum. Ultricies tristique nulla aliquet enim tortor at auctor urna. Orci sagittis eu volutpat odio facilisis mauris sit amet.

Tellus molestie nunc non blandit massa enim nec dui. Tellus molestie nunc non blandit massa enim nec dui. Ac tortor vitae purus faucibus ornare suspendisse sed nisi. Pharetra et ultrices neque ornare aenean euismod. Pretium viverra suspendisse potenti nullam ac tortor vitae. Morbi quis commodo odio aenean sed. At consectetur lorem donec massa sapien faucibus et. Nisi quis eleifend quam adipiscing vitae proin sagittis nisl rhoncus. Duis at tellus at urna condimentum mattis pellentesque. Vivamus at augue eget arcu dictum varius duis at. Justo donec enim diam vulputate ut. Blandit libero volutpat sed cras ornare arcu. Ac felis donec et odio pellentesque diam volutpat commodo. Convallis a cras semper auctor neque. Tempus iaculis urna id volutpat lacus. Tortor consequat id porta nibh.

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Hac habitasse platea dictumst vestibulum rhoncus est pellentesque. Amet dictum sit amet justo donec enim diam vulputate ut. Neque convallis a cras semper auctor neque vitae. Elit at imperdiet dui accumsan. Nisl condimentum id venenatis a condimentum vitae sapien pellentesque. Imperdiet massa tincidunt nunc pulvinar sapien et ligula. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere. Et ultrices neque ornare aenean euismod. Suscipit tellus mauris a diam maecenas sed enim. Potenti nullam ac tortor vitae purus faucibus ornare. Morbi tristique senectus et netus et malesuada. Morbi tristique senectus et netus et malesuada. Tellus pellentesque eu tincidunt tortor aliquam. Sit amet purus gravida quis blandit. Nec feugiat in fermentum posuere urna. Vel orci porta non pulvinar neque laoreet suspendisse interdum. Ultricies tristique nulla aliquet enim tortor at auctor urna. Orci sagittis eu volutpat odio facilisis mauris sit amet.

Tellus molestie nunc non blandit massa enim nec dui. Tellus molestie nunc non blandit massa enim nec dui. Ac tortor vitae purus faucibus ornare suspendisse sed nisi. Pharetra et ultrices neque ornare aenean euismod. Pretium viverra suspendisse potenti nullam ac tortor vitae. Morbi quis commodo odio aenean sed. At consectetur lorem donec massa sapien faucibus et. Nisi quis eleifend quam adipiscing vitae proin sagittis nisl rhoncus. Duis at tellus at urna condimentum mattis pellentesque. Vivamus at augue eget arcu dictum varius duis at. Justo donec enim diam vulputate ut. Blandit libero volutpat sed cras ornare arcu. Ac felis donec et odio pellentesque diam volutpat commodo. Convallis a cras semper auctor neque. Tempus iaculis urna id volutpat lacus. Tortor consequat id porta nibh.

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Hac habitasse platea dictumst vestibulum rhoncus est pellentesque. Amet dictum sit amet justo donec enim diam vulputate ut. Neque convallis a cras semper auctor neque vitae. Elit at imperdiet dui accumsan. Nisl condimentum id venenatis a condimentum vitae sapien pellentesque. Imperdiet massa tincidunt nunc pulvinar sapien et ligula. Malesuada fames ac turpis egestas maecenas pharetra convallis posuere. Et ultrices neque ornare aenean euismod. Suscipit tellus mauris a diam maecenas sed enim. Potenti nullam ac tortor vitae purus faucibus ornare. Morbi tristique senectus et netus et malesuada. Morbi tristique senectus et netus et malesuada. Tellus pellentesque eu tincidunt tortor aliquam. Sit amet purus gravida quis blandit. Nec feugiat in fermentum posuere urna. Vel orci porta non pulvinar neque laoreet suspendisse interdum. Ultricies tristique nulla aliquet enim tortor at auctor urna. Orci sagittis eu volutpat odio facilisis mauris sit amet.

Tellus molestie nunc non blandit massa enim nec dui. Tellus molestie nunc non blandit massa enim nec dui. Ac tortor vitae purus faucibus ornare suspendisse sed nisi. Pharetra et ultrices neque ornare aenean euismod. Pretium viverra suspendisse potenti nullam ac tortor vitae. Morbi quis commodo odio aenean sed. At consectetur lorem donec massa sapien faucibus et. Nisi quis eleifend quam adipiscing vitae proin sagittis nisl rhoncus. Duis at tellus at urna condimentum mattis pellentesque. Vivamus at augue eget arcu dictum varius duis at. Justo donec enim diam vulputate ut. Blandit libero volutpat sed cras ornare arcu. Ac felis donec et odio pellentesque diam volutpat commodo. Convallis a cras semper auctor neque. Tempus iaculis urna id volutpat lacus. Tortor consequat id porta nibh.

13 More Pages to Come in This Document. Get access to the complete answer.

MyAssignmenthelp.com strives to deliver quality content to students of USA and deliver assignment writing services as per individual assignment assistance. We have built up a pool of 3800+ assignment experts who provide academic writing help in more than 100+ subjects. Our skilled and experienced assignment writers deliver custom-made assistances, and they offer need-based university assignment help to students as per their assignment demands.

More C++ Application: Questions & Answers

Q
icon

We aren't endorsed by this University

ITAP2005 Java Programming Fundamentals

Questions: Write a program that reads in the radius and length of a cylinder and computes the area and volume using the following formulas. area = radius * radius * π volume = area * length A year is a leap year, if it is divisible by 4. When user keys in a year, write a program to deter ...

View Answer
Q

Management

create and apply a digital signature against man-in-the middle (encryption & security) I need coding ...

View Answer
Q
icon

We aren't endorsed by this University

CSI218 Data Structures and Algorithms

Question: Project 1: Operashun You will complete a C++ program that implements a simplified version of a classic kids’ game in which each player tries to remove body parts from a patient. Grid Class Body parts within the operating field in the game are represented using a template class ...

View Answer
Q
icon

We aren't endorsed by this University

CS107 C++ Programming

Questions: Camera intrinsics and extrinsics For this project, you need to achieve 3D navigation on a static 2D image by using camera intrinsics and extrinsics. Given a pair of color and depth image captured by Kinect, your job is to reconstruct the 3D geometry with texture information using the i ...

View Answer

Content Removal Request

If you are the original writer of this content and no longer wish to have your work published on Myassignmenthelp.com then please raise the content removal request.

Choose Our Best Expert to Help You

5% Cashback

On APP - grab it while it lasts!

Download app now (or) Scan the QR code

*Offer eligible for first 3 orders ordered through app!

screener
ribbon
callback request mobile
Have any Query?