Here are 2 samples of what is going to be on my next exam for C++ Programming. Would anyone be willing to code these or give me some major help? Im struggling very much in this course and need some help. Anything will help! Im not a millionaire, simply a college student, but I am willing to compensate for anyone who codes these, for without help I will surely fail.
Create a Mask class that satisfies the requirements specified below and a client driver program that thoroughly tests your implementation.
The Mask class should contain the following:
Private data member for a mask string. The actual characters in the mask have the following significance:
The character N requires the string tested to contain a numeric value in that position.
The character A requires the string tested to contain an alpha value in that position.
The character X allows the string tested to contain any character in that position.
Any other character requires the string tested to contain the same character as the mask in that position.
Public member function for getMask (acessor)
Public member function for setMask (modification function)
Public member function testMask that returns a boolean value of true if the string passed as an argument (THIS IS THE STRING TO BE TESTED AGAINST THE MASK) satisfies the mask condition or a Boolean value of false if the argument does not satisfy the mask condition.
A default constructor that will instantiate the object to the NULL string.
A hidden implementation of the class
NOTE: You MUST use the built in string class for all strings used in this assignment. You are to use ONLY C++ instructions that are covered in Chapters 1 - 7 and 12 when implementing this assignment. You may use global constants, but you may not use global variables.
HINTS: The Mask class is generic, some of the uses could be:
A mask to test for a social security number could be NNN-NN-NNNN
A mask to test for a phone number could be (NNN)NNN-NNNN
A mask to test for a date could be NN/NN/NN or NN AAA NNNN
A mask to test for a seven digit part number could be NNNNNNN
Create a Record class that satisfies the requirements specified below, a client driver program that thoroughly tests your implementation and a test data file that thoroughly tests your class.
The Record class should contain ALL of the necessary code to support the reading, parsing and error checking of a file with multiple records. This file contains either 3 or 4 fields. A record for Receipt of products contains a total of 4 fields, while a record for Shipment of products contains only 3 fields.
The 1st letter is for Receipt or Shipment, followed by the part number, then the quantity, and only for receipts: the price.
Sample: Reciept of goods: R123xx12 17 5.99
Sample: Shipment : S123xx12 17
In both types of records, there is no blank space between field one and field two, but there will be one or more spaces between fields 2 and 3 and one or more spaces between fields 3 and 4 (if applicable). Be sure that your parsing detects the entry of negative numbers as well as the entry of decimal values for unit price (with only one decimal point allowed). The name of the input file is "Prog6Input.txt".
Your Record class should support the following specifications:
The input file is to be opened in the constructor, with the file name specified as a c-string when the object is instantiated. The input file is to be closed in the destructor function.
Private data member elements must include the elements of the record (eg: transaction type, partnumber, quantity, unit price and record number). You may fine it helpful, if not necessary, to include other private data member elements.
Public accessor functions for all required private data member elements (getType, getPartNum, getQuant, getCost, getRecNum). NOTE: You do not need to provide accessor functions for other private data member elements that are added for convenience.
The record is to be read as a single string variable using the getline function. Do not use the extraction operator to read the data from the file.
Private member (utility) functions to perform the parsing of the input record into its component members complete with error checking consistent with that specified in Program 2
Public member function getRecord that returns an integer value representing one of the following conditions:
-1 if EOF was encountered
0 if the record has been successfully parsed into the private data member elements
1 if the transaction type is not an R or S
2 if the part number is not 7 characters in length
4 if the quantity is not valid or less than 0
8 if the cost is not valid or less than 0
A hidden implementation of the class.
Your client driver test program should be written so that it displays (in table format with column headers) the data contained in each of the valid records. For records that contain invalid data (error codes returned from getRecord) the test program should display appropriate error messages along with the record number containing the error.