Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ LANGUAGE, no #include stdlib.h or bool statements!!! Need help with files using vim terminal please help!!!! thank you Output needs to match exactly!! You

C++ LANGUAGE, no #include stdlib.h or bool statements!!!

Need help with files using vim terminal please help!!!! thank you Output needs to match exactly!!

You will be developing a speeding ticket fee calculator. This program will ask for a ticket file, which is produced by a central police database, and your program will output to a file. Furthermore, your program will restrict the output to the starting and ending dates given by the user.

The ticket fee is calculated using four multipliers, depending on the type of road the ticket was issued:

Interstate multiplier: 5.2252 Highway multiplier: 9.4412 Residential multiplier: 17.1525 None of the above: 12.152

Console User Interaction

You must ask the user on the console for an input ticket file, an output report file, a report starting date, and a report ending date. The following prompts must be used:

"Enter a ticket file: " "Enter a report file: " "Enter report start date (mm dd yyyy): " "Enter report end date (mm dd yyyy): "

Input File Format

Each line will contain the following information:

 

The citation number may contain numbers and letters.

The month is an integer between 1 (January) and 12 (December).

The day and year are integers.

The clocked speed is an integer in miles per hour.

The speed limit is an integer in miles per hour.

The type of road is a single character: I or i (Interstate), R or r (Residential), H or h (Highway).

Output File Format

Your output file format will be:

-<3-character month>- $

The day must be exactly two digits. If the day is 1 - 9, it must be 01 - 09.

The 3-character month must be the three-character month: Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, or Dec. If an invalid month was specified, the month will be "Err".

The year is simply a 2 or 4 digit year. If the year is only two digits, assume the 21st century. For example, year 10 will be the year 2010.

The citation is exactly the citation given in the input file, but it will be in a left justified field, 10 characters wide.

The $ must follow the citation field.

The fine will be a dollar amount in a right justified field, 9 characters wide.

You will only output those citations that occur between the given report start date and end dates (inclusively).

Restrictions / Hints

You must use I/O manipulators to force the day to be exactly two digits.

You must use I/O manipulators to set the fine to two decimal points.

You must use a constant ARRAY to store (and determine) the 3-character month.

You must use constants for the fine multiplier.

You must use a switch statement to apply the fine multiplier.

You must use I/O manipulators to set the field justifications (right and/or left).

The minimum fine is $0.00. If you calculate a negative fine, you must round it up to exactly $0.00.

Example

Valid input example:

./lab6 Enter a ticket file: ticket Enter a report file: output Enter report start date (mm dd yyyy): 7 1 2017 Enter report end date (mm dd yyyy): 8 11 2018 

ticket file contains:

E059564 8 12 2018 89 55 i E515522 7 3 2017 105 50 r E712221 6 4 2015 200 25 h E219221 12 25 17 2000 10 p 

output file contains:

03-Jul-2017 E515522 $ 943.39 25-Dec-2017 E219221 $ 24182.48 

Missing file example:

./lab6 Enter a ticket file: somebadfilename Unable to open somebadfilename.

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

Databases A Beginners Guide

Authors: Andy Oppel

1st Edition

007160846X, 978-0071608466

More Books

Students also viewed these Databases questions

Question

What is the purpose of the Salary Structure Table?

Answered: 1 week ago

Question

What is the scope and use of a Job Family Table?

Answered: 1 week ago