Description
Version 3.4.2
When disaster hits a populated area, the most critical task is to provide immediately affected people with what they need as quickly and as efficiently as possible.
This project creates an application that manages the list of goods that need to be shipped to ae disaster area. The application tracks the quantity of items needed, tracks the quantity on hand, and stores the information in a file for future use.
There are two categories for the types of goods that need to be shipped:
To complete this project you will need to create several classes that encapsulate your solution.
OVERVIEW OF THE CLASSES TO BE DEVELOPED
The classes used by the application are:
Error
Good
A class that manages a non-perishable good object.
Perishable
iGood
An interface to the Good hierarchy. This interface exposes the features of the hierarchy available to the application. Any “iGood” class can
• read itself from the console or write itself to the console
• save itself to a text file or load itself from a text file
• compare itself to a unique C-style string identifier
• determine if it is greater than another good in the collating sequence
• report the total cost of the items on hand
• describe itself
• update the quantity of the items on hand
• report its quantity of the items on hand
• report the quantity of items needed
• accept a number of items
Using this class, the client application can
• save its set of iGoods to a file and retrieve that set at a later time
• read individual item specifications from the keyboard and display them on the screen
• update information regarding the number of each good on hand
THE CLIENT APPLICATION
The client application manages the iGoods and provides the user with options to
• list the Goods
• display details of a Good
• add a Good
• add items of a Good
• update the items of a Good
• delete a Good
• sort the set of Goods
PROJECT CLASS DIAGRAM
PROJECT DEVELOPMENT PROCESS
In order to earn credit for the whole project, you must complete all milestones and assemble them for the final submission.
FILE STRUCTURE OF THE PROJECT
Each class belongs to its own module. Each module has its own header (.h) file and its own implementation (.cpp) file. The name of each file without the extension is the name of its class.
All the code developed for this application belongs to the aid namespace.
Pre-defined constants:
Pre-define the limits on the years to be considered acceptable:
Private members:
Data:
The year – a four digit integer between min_year and max_year
The month of the year – a value between 1 and 12 inclusive
CIN_FAILED 1 — istream failed on information entry
DAY_ERROR 2 — Day value is invalid
MON_ERROR 3 — Month value is invalid
Member functions:
int mdays(int month, int year) const; (this query has already been implemented for you and is provided)
This query returns the number of days in the specified month of the specified year.
void errCode(int errorCode);
This function sets the error state variable to one of the values listed above.
Public members:
Constructors:
Three-argument constructor: accepts in its parameters integer values for the year, month and day in that order. This constructor checks if each number is in range, in the order of year, month and day and value. If any of the numbers are not within range, this function sets the error state to the appropriate error code and stops further validation. (Use the mday(int,int) member function to obtain the number of days in the received month for the received year. The month value can be between 1 and 12 inclusive). If all of the data received is valid, this constructor stores the values received in the current object, calculates the comparator value, and sets the error state to NO_ERROR. If any of the data received is not valid, this constructor initializes the object to a safe empty state and sets the comparator value to 0.
= year * 372 + month * 31 + day (version 3.4.2 correction 13 -> 31)
Relational Operators
Queries and modifier int errCode() const;
This query returns the error state as an error code value.
bool bad() const;
This query returns true if the error state is not NO_ERROR.
std::istream& read(std::istream& istr);
• This function does not prompt the user.
• If istr fails at any point (if istr fails, the function istr.fail() returns true), this function sets the error state to CIN_FAILED and does NOT clear istr.
• If your read() function reads the numbers successfully, and the read values are valid, it stores them into the current object’s instance variables. Otherwise, your function does not change the current object.
• Regardless of the result of the input process, your function returns a reference to the std::istream object.
std::ostream& write(std::ostream& ostr) const;
Helper functions: operator<<
operator>>
Call your read and write member functions on the right operand in these operators; DO NOT use friends for these global operator overloads.
Include the prototypes for these two helper operators in the header file. Place their prototypes immediately after the class definition.
Testing:
Test your code in Visual Studio using the tester program supplied as the main module.
MILESTONE 1 SUBMISSION
Then run the following script from your matrix account: (replace profname.proflastname with your professors Seneca userid)
~profname.proflastname/submit 244_ms1 <ENTER>
and follow the instructions.
Please note that a successful submission does not guarantee full credit for this milestone.
Reviews
There are no reviews yet.