logo Use CA10RAM to get 10%* Discount.
Order Nowlogo
(5/5)

This project will expand Project 2 by adding additional functionality and implementing abstract data types ADT through classes

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

CS 202 - Computer Science II Project 3 

Due date (FIXED): Monday, 7/29/2019, 3:00 pm 

Objectives: The two main objectives of this project are to test your ability to (1) create and use pointers, and (2) create and use C++ classes. A review of your knowledge of structs, arrays, iostream, file I/O and C-style strings is also included. 

Description: This project will expand Project 2 by adding additional functionality and implementing abstract data types (ADTs) through classes. The new functionality is as follows: You are given an updated data file (e.g. Agencies.txt) where there are 3 rental Car Agency locations, where each of the 3 locations (RentalAgency) has 5 cars (RentalCar). You will have similar menu options, but the functionality has been updated below. Note: using multiple helper functions to do smaller tasks will make this project significantly easier. You may want to create a function that will get a car from a location based on the location and car indices. 

The RentalCar Class will contain the following private data members: 

  • year, an int (year of production) 
  • make, a C-string (char array of 256 maximum size) 
  • model, a C-string (char array of 256 maximum size) 
  • price, a float (price per day) 
  • available, a bool (1 = true; 0 = false; try to display true/false using the "std::boolalpha" manipulator like: cout << boolalpha << boolVariable;

and will have the following public methods: 

  • Default Constructor – will set the aforementioned data members to default initial values of your selection, and m_available specifically to false. (Hint: Remember to use properly named constants where appropriate). 
  • Parameterized Constructor – will create a new object based on the values of the arguments passed into it. In its parameters list: a) there should be a parameter corresponding to every one of the class data members, b) there should also be a default parameter for the parameter used to specify whether the car is available. 
  • Separate get and set methods for all data members. 
  • print – will print out all the car’s data. 
  • estimateCost – will estimate the car’s cost given (via a parameter passed to it) a number of days to rent it for. 

The RentalAgency ADT will be a struct and will contain the following data members: 

  • name, a C-string (char array of 256 maximum size) 
  • zipcode, an int array of size 5 (Hint: You will NOT be able to use cin and cout –or any fstream objects– directly with this int array as you were doing so far with C- strings. The reason is that reading/writing is specially handled by C++ for char array types. You will need to manage reading/writing to an int array on your own.) 
  • inventory, an array of RentalCar objects with a size of 5 

The menu must have the following entries, each implementing a functionality: 

  • Ask the user for the input file name. Then, read ALL data from that file (the file has been structured where the first line is the Car Agency info, followed by 5 cars). The data have to be stored into arrays of Class type Objects
  • Print out to terminal ALL data for all Agencies and all their corresponding Cars in a way that demonstrates this relationship (see Sample Output section). 
  • Estimate car rental cost - prompt for: a) an Agency (e.g., Hertz – you can do so with a 0-2 int array index number per-Agency), b) a Car number (with a 0-4 int array index number per-Car of each agency), c) the number of days to rent it for (rental_cost=days_to_rent*price_per_day). 
  • Find the most expensive Car – Print to terminal the single most expensive Car out of all 3 Agencies. 
  • Print out only the available Cars - from all Agencies, to a separate output file (when the user chooses menu entry 5, they should also get asked for an output file name). 
  • Exit program. 

The following minimum functionality and structure is required: 

  • Ask the user for the input file name. 
  • The list(s) of cars must be stored into array(s) of Class type Objects
  • The list of agencies must be stored into an array of Struct Objects
  • Use character arrays to hold your strings (i.e., C-strings) exclusively (using the std::string data type is still not allowed). 
  • Write multiple functions (Hint: You could have each menu option be a function). 
  • The other functionality and structure of the program should remain the same as Project #2, including writing to screen and file, as well as restrictions on string libraries, global variables and constants, etc. 

Implement the concepts of encapsulation and data hiding! Making the RentalCar data members private and implementing a public interface through the class Constructors and other methods is your first acquaintance with these concepts in practice. 

Try to structure your class source code to implement the concepts of encapsulation and data hiding! Try to structure your declarations and implementaions as much as possible into class/struct header files (e.g. RentalCar.h, RentalAgency.h), class/struct source files (e.g. RentalCar.cpp, RentalAgency.cpp), and other source files (proj3.cpp). Do your best in order to acquaint yourself with these new concepts at this early point, so that it pays off in future project which will impose such hard requirements. 

Sample Output for menu option 2: Hertz 93619 2014 Toyota Tacoma , $115.12 per day , Available: true 2012 Honda CRV , $85.1 per day , Available: false 2015 Ford Fusion , $90.89 per day , Available: false 2013 GMC Yukon , $110.43 per day , Available: false 2009 Dodge Neon , $45.25 per day , Available: true 

Alamo 89502 2011 Toyota Rav4 , $65.02 per day , Available: true 2012 Mazda CX5 , $86.75 per day , Available: true 2016 Subaru Outback , $71.27 per day , Available: false 2015 Ford F150 , $112.83 per day , Available: true 2010 Toyota Corolla , $50.36 per day , Available: true 

Budget 93035 2008 Ford Fiesta , $42.48 per day , Available: false 2009 Dodge Charger , $55.36 per day , Available: true 2012 Chevy Volt , $89.03 per day , Available: false 2007 Subaru Legacy , $59.19 per day , Available: false 2010 Nissan Maxima , $51.68 per day , Available: true 

The completed project should have the following properties: 

  • Written, compiled and tested using Linux. 
  • It must compile successfully using the g++ compiler on department machines. Instructions how to remotely connect to department machines are included in the Projects folder in WebCampus. 
  • The code must be commented and indented properly. Header comments are required on all files and recommended for the rest of the program. Descriptions of functions commented properly. 
  • A one page (minimum) typed sheet documenting your code. This should include the overall purpose of the program, your design, problems (if any), and any changes you would make given more time. 

Turn in: Compressed .cpp file and project documentation. 

Submission Instructions: 

  • You will submit your work via WebCampus 
  • Name your code file proj3.cpp 
  • If you have header file, name it proj3.h 
  • Compress your: 1. Source code 2. Documentation Do not include executable 
  • Name the compressed folder: PA#_Lastname_Firstname.zip ([PA] stands for [ProjectAssignment], [#] is the Project number) Ex: PA3_Smith_John.zip 

Verify: After you upload your .zip file, re-download it from WebCampus. Extract it, compile it and verify that it compiles and runs on the NoMachine virtual machines or directly on the ECC systems. 

  • Code that does not compile will be heavily penalized –may even cost you your entire grade–. Executables that do not work 100% will receive partial grade points. 
  • It is better to hand in code that compiles and performs partial functionality, rather than broken code. You may use your Documentation file to mention what you could not get to work exactly as you wanted in the given timeframe of the Project. 

Late Submission: A project submission is "late" if any of the submitted files are time-stamped after the due date and time. Projects will be accepted up to 24 hours late, with 20% penalty. 

(5/5)
Attachments:

Expert's Answer

842 Times Downloaded

Related Questions

. Introgramming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma

. The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

. Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual

Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th

. SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

. Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

842 Times Downloaded

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Um e HaniScience

688 Answers

Hire Me
expert
Muhammad Ali HaiderFinance

948 Answers

Hire Me
expert
Husnain SaeedComputer science

945 Answers

Hire Me
expert
Atharva PatilComputer science

717 Answers

Hire Me