We're Open
+44 7340 9595 39
+44 20 3239 6980

A CAR RENTAL COMPANY MAINTAINS RECORDS

  100% Pass and No Plagiarism Guaranteed

A CAR RENTAL COMPANY MAINTAINS RECORDS

Programming Assignment #3 (covers array of records and unordered list searching)

A car rental company maintains records about the cars they rent in a file named RENTALS.TXT.
Data stored about each car includes: the license plate number, the mileage, and whether the car is currently rented, stored as follows:
Data Field Data Type
license string type (six characters: 2 letters followed by 4 digits)
mileage integer
rented boolean (within the program)
Sample RENTALS.TXT data Lines:
XY1111 6530 0
AA1234 12444 0
KQ2222 78511 1

Note that the ordinal value of the boolean rented value is stored in the data file (false = 0, true =1). This enables the program to simply write the data to the file from the boolean type field, with no conversion.
Write a program to help the use and manage the file. The data from the file will be stored during program execution as an array of records, with one record (struct) for each. The array should be declared to hold up to 500 records.
Program Implementation
After displaying a short program introduction, begin the program by asking the user whether they want to use existing information. Example:
Load existing data from a file (Y/N)?
If the user chooses to use existing data, the program will try to read the data from a previously stored data file RENTALS.TXT into an array of records.
The program will check to see if the file exists, before trying to read from it. If the file doesn`t exist, the program will present an error message about the file, and ask the user whether he wishes to exit the program, or proceed starting with no data.
If the file exists, the program will read the data from the file into an array of records. When reading data from an existing data file, you may assume that all data in the file is valid and properly formatted, so you do not need to error check it.

NOTE: Storing the boolean value for the rented field will be a 2-step process.
First read the integer number into a temporary integer variable.
Then use static_cast to convert the integer to a boolean and store it in the array.
As you read the data from the file, keep track of the number of cars stored. Your program should error check that there are not too many data lines in the input data file, so that the data will not overrun the array boundaries. If there are over 500 data lines in the input file, issue an error message that further listings will be ignored, and do not read any more data records from the file.
AFTER all the car records have been read from the data file into the array of records
(OR if the file does not exist and the user chooses to continue anyway with an initially empty array),
Give the user a menu of choices, as follows. Use a mnemonic letter for each menu option (NOT numbers) with the letter listed to the left of the menu option description:
Show Cars (to the screen)
If the array is empty, simply display a message stating there are no cars stored.
Otherwise, display all data in columns, with one line per listing.
Display the rented status in a word, not a letter or boolean ordinal value.
Include column headers for each data item.

Sample output lines (use this format):
License
Number Mileage Rented
------ -------- ------
XY1111 65300 no
AA1234 12444 no
KQ2222 8511 yes

Add cars(s) to the array
a) Add a new car to the array (if there is still room in the array).
Call a separate user-defined function to read each data item for one record.
b) Loop, adding listings to the array until the user says s/he is done,
OR until the max of 500 cars has been entered.
NOTE: Once the array contains 500 listings, do not ask whether to add another!
The program MUST error check all user input, as detailed below.
Write a separate function to read and validate each data field entered by the user (the prompt, read and validation should all be done from inside the function).
If the data entered by the user is invalid, the function should issue an error message stating why it is invalid, and prompt the user to re-enter the information. Each function should loop and re-prompt for the item, until it is valid.


The Add function will call each of the three input data reading functions that reads one data item. As each function has read and validated the required data, the validated data will be returned to the Add function for storage in a field of a record within the array.
Required error checking:
- Validate the license number format
The string must be 6 characters long and contains only letters and digits
(and no spaces), in the correct location (2 letters followed by 2 digits)
NOTES:
In order to read a license and verify that it does not contain spaces, you will need to use getline (covered in text Chapter 3) because the extraction operator (>>) will only read strings up to the first whitespace.
String character error checking must be performed using loops to examine each character, not brute force. Remember that each character of a string can be accessed using an index, just like an array.
- Verify the mileage is a positive, non-zero value.
- Verify that a valid value is entered for rented
The program should ask the user whether the car is rented, and tell the user how to enter the answer (e.g. Is the car currently rented (Y/N)? )
But make sure that the value converted to a boolean before being stored into the array, no matter how the input is read from the user.
Delete a listing
If the array is empty, simply display a message stating there are no cars stored.
If the array contains listings:
a) Display License Numbers of all cars stored, as choices for user
b) Ask the user for the License Number of the car to delete
c) Read the entered License Number and validate the format
(use the License Number reading function created for Adding a Car)
d) Find the License Number in the array
e) If the License Number is found, delete the record from the ARRAY
Reminder: Deleting from arrays was covered in online content sections 3.4.3 and 3.4.4.
f) Display a message confirming which listing has been removed,
or stating that the License Number could not be found.
Exit the program
When the user chooses to exit, the program should ask whether to save/re-save the data to the RENTALS.TXT file before exiting, and do so if requested (overwriting the original data file).
If the user chooses NOT to save, simply exit (but first issue message that the user will lose all changes made).


Each time a menu choice is entered, the program will error check the user has entered a valid choice, before performing the task, and will issue an error message if the choice is not valid.
The program will loop, performing menu tasks, until the user chooses Exit.
NOTE: After reading the data from the file at the beginning of the program (if existing data was chosen), the file should not be accessed again until the end of the program, and then only if the user decides to re-save the data. All of the modifications will be done to the data in the array of records only (i.e. show, add, and delete menu choices will NOT access the file!)
NOTE: You will be modifying this program for a later assignment, so take care in the initial design.
Program Notes:
1. Your program must conform to all CS362 Coding Standards specified in Content section 1.4.
2. This program should be of modular design (minimum of TEN functions that have arguments or return values), use proper parameter passing and prototypes. The module breakdown should be logical, with main doing little more than call other functions, and the other functions each performing only one well-defined task.
3. Descriptive function, constant, and variable names should be used. Constants/variables should be commented. All fixed values should be defined as constants.
4. All code will be structured C++ code. Object-oriented programming (classes, templates, etc) will
not be used.
Submission
Submit:
- your program code
- any data files used to test your code
to the Wk 4 – Assn 3 folder in the Dropbox area of the online course, by midnight, Sunday of week 4 (next week).
WARNING:
Your program will NOT be accepted if it:
 does not compile
 uses any global variables
 is not adequately modular (i.e. contains fewer than the required number of functions)
Before attaching your files to the assignment submission, please NAME them as follows:
LastnameAssn#.cpp
LastnameDatafilename.txt
For example: SmithAssn3.cpp
SmithRENTALS.TXT
However, within your code, please use RELATIVE file names (no drive or pathnames):
RENTALS.TXT


EXTRA CREDIT OPTION (10%):
Warning: Do not attempt to implement the extra credit unless you have first successfully implemented the normal part of the assignment. You will not receive any extra credit if the normal part of the assignment is not functioning properly. Before starting on the extra credit, make sure you have the time, and are confident in your ability to complete it. Be sure to save a copy of the normal part of the assignment, in case your efforts on the extra credit are unsuccessful.
For extra credit, add the following features to your program:
a) When a user adds a new car, check to see if the license number is already in the listings.
Do not allow a user to add a license number that is already stored in the array.
b) Store each new car into the array in ascending order, by license number,
without sorting the array (i.e. As each car is read from the data file or user, insert that car
into the correct location within the array).
c) Use a binary search to find records for deletion.
d) When the array is empty, the main menu should display only the ADD and EXIT choices. When the array is full, the menu should not display the ADD option. And if the user chooses an option that is not currently displayed on the menu, an error message should be displayed
If you implement some parts of the extra credit, partial extra credit may be given, but only if all the normal portions of the assignment works correctly.

Grading
The rubric that will be used to grade your program is included on the next pages.


CS 362 Data Structures
Programming Assignment #3 Rubric
Rating
Exemplary
Partially Proficient
Basic (needs work)
Not Demonstrated
Rating Category Documentation 10%
Documentation includes complete and accurate file and function headers, as detailed in the CS362 coding standards, along with additional in-line comments at appropriate locations.
Documentation includes all required headers, but lacks some clarity or details, OR violated minor details of CS362 coding standards for comments, OR code is over commented.
Documentation is incomplete and/or incorrect and/or formatted incorrectly and/or violated multiple rules within the CS362 coding standards for comments.
Only a few (or no) comments in program. Data Storage 8%
Constants used for all fixed values, and all constants and variables defined using correct data types within correct program scope, following CS362 coding standards.
A few minor errors in data declaration scope, data typing or assignment, OR missing a couple of necessary constants, OR some identifier names not descriptive enough, OR violated minor details of CS362 coding standards.
Missing many constants for fixed values, AND/OR most identifier names not descriptive enough, AND/OR violated multiple rules within the CS362 coding standards for constant and variable usage.
Major errors in most or all of the constant/variable definitions or assignments AND/OR did not follow most of the CS362 coding standards for constant and variable usage. Input File Handling: (Reading and Storing Data) 8%
Code tests file opened correctly, before trying to read from it, and exits gracefully if file does not exist. Reads data into array during one pass of reading the file and correctly implements error checks to prevent array overflow. Correctly recognizes end of file, and closes file immediately after done reading data.
Incorrectly implements: file opening test so program crashes or does not exit when file does not exist OR array bounds testing so overflow occurs or messages incorrect, OR file opened multiple times, OR file not closed after use, OR other minor issues while reading file data into arrays.
Multiple problems with opening and/or closing input file AND/OR missing array overflow prevention code AND/OR multiple other errors that prevent the program from correctly reading and storing data from the file.
No data read from the input file. Program Processing: main function and Action Menu function 8%
Allows for new or existing data usage. Displays all menu options. Prompts for user choice. Error checks choice entered, re-prompting if necessary. Loops correctly and exits correctly via menu choice.
Minor issues with menu display, prompting, choice error checking, or looping.
Many minor issues or one or more major issue(s) with menu display, prompting, choice error checking or looping.
Menu not implemented.

User Input: Error Checking and Formatting 12%
Error checks all input. A separate function implemented to read and error check each data field, re-prompting until valid. String fields are checked for length, proper characters in proper positions, etc, and formatted as specified.
Minor issue with prompts, reading user input, error checking and looping until input is valid, or formatting input, OR used brute force to check each character in a string, instead of a loop, OR did not create one or two of the separate functions.
Many minor, or one or more major error(s) with prompts, reading user input, error checking and looping until input is valid, or formatting input, OR did not create any of the separate input functions.
No error checking or formatting of user input was implemented. Program Processing: Adding Records 10%
Checks if array is full before adding each item. Loops until array is full or user chooses to stop entering data. Works correctly for empty array or partially full array.
Minor issues with storing record in array, prevention of array overflow, asking user whether to add another, or looping.
Array overflow checks were not implemented, or other major issues with storing record in array, asking user whether to add another, or looping.
Records could not be added to the array. Program Processing: Displaying Records 6%
Displays all array data (lined up under headers), one line per record, with enum type spelled out as a string. Error msg displayed if array is empty.
Minor problems with display formatting, OR does not satisfy one of the other requirements.
Multiple problems with display output.
Completely fails to display data in array. Program Processing: Deleting One Record 10%
Displays choices. Prompts for key and verifies key entered is valid format. Finds key and displays all data for that record. Deletes record from array and displays confirmation message. Error message given if key is not in array or array is empty.
Choices not displayed, OR format not validated, OR confirmation message not given, OR error message not given, OR duplicates search code, OR other minor error.
Multiple problems with deleting a record.
Records could not be deleted. File Output: Saving Array Data 8%
When exit is chosen from menu, asks whether to save before exiting. If user answers yes: Output file opened correctly. Array data written to file in same format as input file. File closed correctly and program exits. If user answers no: just exits
Minor problems with file formatting OR does not satisfy one of the other requirements for file output.
Multiple problems with file output.
Fails to produce any file output.

Modularity (functional breakdown) 8%
Program is efficient, modular (at least 10 prototyped functions with parameters or return values, not including main), and logically organized. Each module performs ONE well-defined task and is defined and called correctly. main function does little more than call other functions.
Program is mostly efficient and modular in design, with most of the code logically organized. Contains minimum required number of functions, but may have an unnecessary function, a function that performs too many tasks, and/or a function that is incorrectly defined or called.
Multiple modules are unnecessary or perform too many tasks, OR parts of the program are not efficient and/or logically organized, OR one required function is missing, OR multiple problems with module definitions/calls.
Program is somewhat modular, but the module breakdown is not at all efficient and/or logically organized.

NOTE: If program is not modular enough (i.e. is missing more than one required function) then it will not be accepted! C++ Constructs / Readability / Miscellaneous 12%
Demonstrates understanding of control, data, and file structures. All parameters passed correctly. Code is exceptionally well organized, easy to follow, and adheres to all CS362 coding standards for code usage (e.g. no use of break/return to exit a loop)
A parameter or two was passed incorrectly (value vs. reference), OR unnecessary parameter(s) was passed, OR minor improper control or data structure usage, AND/OR some occasional spacing, indentation, and/or other minor organizational issues.
One or more major error(s), to include lots of incorrect parameter definition and usage, AND/OR substantial spacing, indentation, and/or other organizational issues.
Demonstrates minimal understanding of control/data structures and/or proper parameter passing AND/OR major coding standard violations throughout, AND/OR other major organization, construct, or readability issues. Extra Credit (ONLY given if rest of program is implemented correctly for the most part) 10%
Checks if key value exists in the array already; gives error msg and re-prompts if it does. Inserts data into array in sorted order by key value. Uses binary search to find data. Modified main menu so that only valid choices appear.
Implemented most of the extra credit.
Implemented some of the extra credit.
Did not implement any of the extra credit items OR implemented some of the extra credit at the expense of leaving many errors in the original programming assignment.


 

100% Plagiarism Free & Custom Written,
Tailored to your instructions


International House, 12 Constance Street, London, United Kingdom,
E16 2DQ

UK Registered Company # 11483120


100% Pass Guarantee

STILL NOT CONVINCED?

View our samples written by our professional writers to let you comprehend how your work is going to look like. We have categorised this into 3 categories with a few different subject domains

View Our Samples

We offer a £ 2999

If your assignment is plagiarised, we will give you £ 2999 in compensation

Recent Updates

Details

  • Title: A CAR RENTAL COMPANY MAINTAINS RECORDS
  • Price: £ 109
  • Post Date: 2018-11-08T12:13:29+00:00
  • Category: Assignment
  • No Plagiarism Guarantee
  • 100% Custom Written

Customer Reviews

A CAR RENTAL COMPANY MAINTAINS RECORDS A CAR RENTAL COMPANY MAINTAINS RECORDS
Reviews: 5

A masterpiece of assignment by , written on 2020-03-12

I ordered the literature review for my research project in rush delivery. I was not expecting that they would complete my order 2 hours before my chosen time. The quality is also nice. Thank you for help.
Reviews: 5

A masterpiece of assignment by , written on 2020-03-12

Writing is not my field. I take help from this website for my accounting assignment. The work is good and I scored good grades in it. Thank you from the bottom of my heart.