Thread: Little Help?

  1. #1
    Registered User
    Join Date
    Oct 2008
    Posts
    5

    Little Help?

    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.
    .......................
    PROBLEM:

    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
    ......................................
    PROBLEM:

    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.

  2. #2
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    I am willing to compensate for anyone who codes these, for without help I will surely fail.
    Jobs go in a different forum, and how would people be compensated?

  3. #3
    Registered User
    Join Date
    Oct 2008
    Posts
    5
    Quote Originally Posted by citizen View Post
    Jobs go in a different forum, and how would people be compensated?
    Financially obviously. As far as how much, whatever is fair to whomever does it.

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    If you can't do the work, why should you pass?



    Or let me put it another way.

    I don't want you working next to me if you sponged your qualification off the efforts of other people. Been there, done that, not interested in repeating the experience (or foisting it on anyone else).

    An empty chair is far more productive than some wannabe who's barely mastered switching the machine on, nevermind being any good at programming.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  5. #5
    Registered User
    Join Date
    Oct 2008
    Posts
    5
    This is not homework, nor anything that will receive credit. Its off a review. I am not solely asking for someone to do it. If someone could give me some help to get me started, that would also be a huge help

  6. #6
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    What help do you need then? Asking for help to get you started is rather vague, especially since we have no idea how much you actually know.

    For example, you could post what you tried, and what went wrong.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  7. #7
    Registered User
    Join Date
    Oct 2008
    Posts
    5
    Ok, firstly, I cant seem to grasp the concept of using multiple files in a project(the layout its supposed to be is a header, a driver, and the main). Secondly, im a little thrown off by what needs to be private/public in a class.

    what ........es me off, is I got an A in the 1st part, but now that were to object oriented programming I cant seem to get it

  8. #8
    Registered User
    Join Date
    Oct 2008
    Posts
    5
    Im trying not to have to drop the class but, if I cant get the concepts in the next few days Ill be too far behind.

  9. #9
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Fine, a little start
    Code:
    #include <iostream>
    int main ( ) {
        std::cout << "Warp factor 9 Scotty";
        return 0;
    }
    More?

    Much more?

    Less maybe?

    *shrug*

    > This is not homework, nor anything that will receive credit.
    Yet in post #1 it was
    > I am willing to compensate for anyone who codes these, for without help I will surely fail.

    If you're going to make up stories, work on making them consistent.
    Then forget about programming and go into publishing.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  10. #10
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    Well I know even though I am in school right now as a pre-med student that since I am a software engineer I always help out all the comp sci students here who need some extra help (within reason, obviously). Long story short, is there not someone at your place of education who is willing to help tutor you in some way or another? Or give you hands on help? Giving someone answers is often less fruitful in the long run since a person who is given answers rarely absorbs as much as someone who finds answers on their own.

    "Your code is over my head." Or similar is the common result of just getting freebies.

  11. #11
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    > what ........es me off, is I got an A in the 1st part
    What, you mean by yourself?

    Just read your book on classes a few more times, and then see what you can come up with.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  12. #12
    Hail to the king, baby. Akkernight's Avatar
    Join Date
    Oct 2008
    Location
    Faroe Islands
    Posts
    717
    You peeps don't have to massivly harass him with hostility of high.... something :P just 'cause he doesn't really know what he's doing or asking or maybe something else :P there's deffinetly a reason for his post, don't flame him for it
    Never done a mistake yourselves?
    Currently research OpenGL

  13. #13
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by Akkernight View Post
    You peeps don't have to massivly harass him with hostility of high.... something :P just 'cause he doesn't really know what he's doing or asking or maybe something else :P there's deffinetly a reason for his post, don't flame him for it
    Never done a mistake yourselves?
    You haven't been round here a lot, have you?

    Every day, nearly, we get a post or two from some poor sod who think they can post their assignment here and get something they can give to their teacher. It gets a bit tedious, so having some fun at their expense is one way to make it less boring. Sorry if that offends you.

    To the original poster: if you show us what you have done so far, we can probably help you. However, us posting the "correct results" for you will not help you any more than reading books makes you a good author. You will need to practice. You can use this forum as a resource for resolving small problems, but not for "I don't know what I'm supposed to do, please do it for me".

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  14. #14
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    And sometimes people just turn into easy marks by making themselves a little less than receptive to our various senses of humor. We pick on one another just as harshly. Never you worry about that.

  15. #15
    Hail to the king, baby. Akkernight's Avatar
    Join Date
    Oct 2008
    Location
    Faroe Islands
    Posts
    717
    So, no one around here has a feeling called... It's when you think of others before you :P
    'Cause when I was a bit younger I did the exactly same thing, asked questions without knowing why, or no solid ground for it :P
    Stopped coding 'cause the peeps made me think I just was too dumb to code, and I belived them >.< was new to the internet back then too :P
    Currently research OpenGL

Popular pages Recent additions subscribe to a feed