Results 1 to 11 of 11

Math Help - faulty question on assignment

  1. #1
    Member Jskid's Avatar
    Joined
    Jul 2010
    Posts
    160

    faulty question on assignment

    I have an assignment to write a program that reads a rectangular "picture" made up of two characters. The width and height are specified on the first line. For example

    9 7
    A A A A A A A
    A C C C C C A
    A C A A A A A
    A C A A A A A
    A C C C A A A
    A C A A A A C
    C C A A A A A
    A C A A A A A
    A A A A A A C

    9 means 9 rows and 7 means 7 columns (according to instructions). This must be stored in a two dimensional array. Once the picture is read, a transformation such as a diagonal flipping is applied.

    See any problems?
    1. The number of columns is wrong because it doesn't take into account spaces (or the new line character)
    2. It is unclear what happens to the spaces when a transformation is applied
    3. In some example data there is an empty space after the first line



    I thought that flipping would change the spaces into newlines for example the above would become

    AACAAAAAA

    ACCCCCCCA

    AAAACAACA

    AAAACAACA

    AAAAAAACA

    AAAAAAACA

    CAACAAAAA

    but it turns out this is extremely difficult or impossible to implement in the programing language we are using (you can't just change all spaces to newlines, then there would be huge clumps of empty lines).

    Apparently other students assumed to drop all the spaces and this is what the instructor wants. I think this is crap because you can't arbitrarily discard data. I staid up the entire night trying to get it to work with spaces and I didn't have time to do the next question.

    What should I say to the instructor? I'm thinking of an extension, b/c it took me a while to figure out what she asked for is impossible (unless you discard the spaces). Do you think I have grounds?
    Last edited by Jskid; October 5th 2011 at 12:02 PM. Reason: fixed typos
    Follow Math Help Forum on Facebook and Google+

  2. #2
    MHF Contributor

    Joined
    Aug 2006
    Posts
    18,786
    Thanks
    1683
    Awards
    1

    Re: faulty question on assignment

    Quote Originally Posted by Jskid View Post
    I have an assignment to write a program that reads a rectangular "picture" made up of two characters. The width and column are specified on the first line. For example
    9 7
    A A A A A A A
    A C C C C C A
    A C A A A A A
    A C A A A A A
    A C C C A A A
    A C A A A A C
    C C A A A A A
    A C A A A A A
    A A A A A A C
    9 means 9 rows and 7 means 7 columns. This must be stored in a two dimensional array. Once the picture is read, a transformation such as a diagonal flipping is applied.

    See any problems?
    [LIST=1][*]The number of columns is wrong because it doesn't take into account spaces (or the new line character)[*]It is unclear what happens to the spaces when a transformation is applied[*]In some example data there is an empty space after the first line
    Of course, I have no idea what course this is much less what language you are using.
    But I have done programming in the distant past.
    What do spaces have to do with this.
    It would seem that this is a data storage exercise.
    You are swapping a 9\times 7 matrix for a 7\times 9?
    You say the your classmate have assumed that.
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Member Jskid's Avatar
    Joined
    Jul 2010
    Posts
    160

    Re: faulty question on assignment

    The assignment says we are given the number of columns there are to read. In the above example that is 7. So I read the first 7 characters from the first line and get 'A', ' ', 'A', ' ', 'A' ,' ', ,'A'. That's not right b/c I'm missing 3 A's. So I figure multiply the columns by 2 to account for the spaces. This works well until we get to certain image transformations. It turned out that my classmates and teacher wanted the spaces to be discarded right when it was red. The teacher never specified this.
    Follow Math Help Forum on Facebook and Google+

  4. #4
    Member Jskid's Avatar
    Joined
    Jul 2010
    Posts
    160

    Re: faulty question on assignment

    Imagine the spaces as another character e.g.
    A_A_A_A_A_A_A
    A_C_C_C_C_C_A
    A_C_A_A_A_A_A
    A_C_A_A_A_A_A
    A_C_C_C_A_A_A
    A_C_A_A_A_A_C
    C_C_A_A_A_A_A
    A_C_A_A_A_A_A
    A_A_A_A_A_A_C
    Follow Math Help Forum on Facebook and Google+

  5. #5
    MHF Contributor
    Opalg's Avatar
    Joined
    Aug 2007
    From
    Leeds, UK
    Posts
    4,041
    Thanks
    7

    Re: faulty question on assignment

    I think you are confusing the data with the presentation of the data. The statement of the problem clearly specifies that the data is stored in a 9x7 array. In order to present the data legibly in a printout it is usual to insert spaces between the data items. But the flipping problem applies to the 9x7 array, not to the printout. How to display the original data or the flipped data is another matter altogether, not relevant for the problem. The rest of the class apparently understood that this was clearly what the instructor intended. It is unfortunate that you attempted to deal with a much more elaborate problem. I think you should explain this to the instructor and hope that she takes a sympathetic attitude. But don't go telling her that the question is faulty, because it isn't.
    Follow Math Help Forum on Facebook and Google+

  6. #6
    Member Jskid's Avatar
    Joined
    Jul 2010
    Posts
    160

    Re: faulty question on assignment

    It wasn't a print out that had spaces, it was the example data file. Your right I probably should say I misunderstood the question but I'm pretty sure I understood it clearest.

    Your point about the difference between data and format is insightful, but I can't see any reason to assume the spaces are part of the format and not data.
    Last edited by Jskid; October 5th 2011 at 02:06 PM.
    Follow Math Help Forum on Facebook and Google+

  7. #7
    MHF Contributor

    Joined
    Mar 2011
    From
    Tejas
    Posts
    3,401
    Thanks
    762

    Re: faulty question on assignment

    This must be stored in a two dimensional array
    the picture is made of two characters. this is stored in a 2-dimensional array. it doesn't matter "what" the characters are (they could indeed be spaces, or control characters such as line breaks).

    depending on how you instruct the array to be displayed, you might wind up with what looks like you have typed at the beginning, or something VERY different. this is not a feature of the array itself, but rather on a higher level of "interpretation" (which is language-specific).

    there is nothing in your statement of the assignment that indicates spaces (empty characters) should be converted to line breaks (newline characters).

    check again what the domain of definition of your transformations is. i believe the diagonal flip amounts to what is known as the "transpose", that is, replacing the array element (a,b) with (b,a). so, for example the array:

    A A A A <--- 7 characters, 3 of which are " " (blank).
    A A A A
    A A A A
    A A A A
    A A A A
    A A A A
    A A A A
    A A A A
    A A A A would get transformed to:

    AAAAAAAAA
    <----this is a "blank row"
    AAAAAAAAA

    AAAAAAAAA

    AAAAAAAAA (the "blank columns" have become "blank rows").

    depending on how the programmming language parses spaces, these might not be displayed as above.
    Follow Math Help Forum on Facebook and Google+

  8. #8
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4

    Re: faulty question on assignment

    Quote Originally Posted by Jskid View Post
    I have an assignment to write a program that reads a rectangular "picture" made up of two characters. The width and height are specified on the first line. For example

    9 7
    A A A A A A A
    A C C C C C A
    A C A A A A A
    A C A A A A A
    A C C C A A A
    A C A A A A C
    C C A A A A A
    A C A A A A A
    A A A A A A C

    9 means 9 rows and 7 means 7 columns (according to instructions). This must be stored in a two dimensional array. Once the picture is read, a transformation such as a diagonal flipping is applied.
    You are told that the picture consists of an array of two characters. If you take the spaces to be significant there are three characters, so you must assume that the spaces are not significant. The first line also tells you how many rows and columns are to follow, if the spaces are significant this data is nonsense.

    Also if you assume you are going to use a binary read there are more "characters" there than A,C and <space>. So you are not going to use a binary read, so the spaces and <cr> and/or <lf>'s etc are just field separators.

    This is a programming assignment, you should get used to errors and ambiguities in specifications and requirements (not that there is any significant ambiguity in this case).

    CB
    Last edited by CaptainBlack; October 5th 2011 at 11:07 PM.
    Follow Math Help Forum on Facebook and Google+

  9. #9
    Member Jskid's Avatar
    Joined
    Jul 2010
    Posts
    160

    Re: faulty question on assignment

    Quote Originally Posted by Deveno View Post
    the picture is made of two characters. this is stored in a 2-dimensional array. it doesn't matter "what" the characters are (they could indeed be spaces, or control characters such as line breaks).

    depending on how you instruct the array to be displayed, you might wind up with what looks like you have typed at the beginning, or something VERY different. this is not a feature of the array itself, but rather on a higher level of "interpretation" (which is language-specific).

    there is nothing in your statement of the assignment that indicates spaces (empty characters) should be converted to line breaks (newline characters).

    check again what the domain of definition of your transformations is. i believe the diagonal flip amounts to what is known as the "transpose", that is, replacing the array element (a,b) with (b,a). so, for example the array:

    A A A A <--- 7 characters, 3 of which are " " (blank).
    A A A A
    A A A A
    A A A A
    A A A A
    A A A A
    A A A A
    A A A A
    A A A A would get transformed to:

    AAAAAAAAA
    <----this is a "blank row"
    AAAAAAAAA

    AAAAAAAAA

    AAAAAAAAA (the "blank columns" have become "blank rows").

    depending on how the programmming language parses spaces, these might not be displayed as above.
    Yes, where you have 7 characters the assignment would have 4. If the spaces are dropped it would have been much easier to read the file.

    I talked to the prof and since I was the only one who saw this, no extension. At any rate I'm tired of doing more work and getting less credit, is there anything I can change to fix it?
    Follow Math Help Forum on Facebook and Google+

  10. #10
    MHF Contributor

    Joined
    Mar 2011
    From
    Tejas
    Posts
    3,401
    Thanks
    762

    Re: faulty question on assignment

    the only thing i can suggest is that when you have a question about an assignment, talk to your instructor sooner, rather than later. the point of taking a class is not to "get the homework done", it's to understand the material. that is, there are certain things the instructor intends to communicate. you'll probably not get any points for quibbling about technicalities, and ignoring the bigger picture, even if you have a valid concern.
    Follow Math Help Forum on Facebook and Google+

  11. #11
    Member Jskid's Avatar
    Joined
    Jul 2010
    Posts
    160

    Re: faulty question on assignment

    Quote Originally Posted by Deveno View Post
    the point of taking a class is not to "get the homework done", it's to understand the material.
    Ideally that's the case
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. hyperbolic assignment question
    Posted in the Trigonometry Forum
    Replies: 4
    Last Post: September 25th 2009, 03:12 AM
  2. Natural Log and Log Assignment Question
    Posted in the Algebra Forum
    Replies: 2
    Last Post: May 26th 2009, 12:47 PM
  3. Can't figure out this assignment question.
    Posted in the Algebra Forum
    Replies: 2
    Last Post: May 23rd 2009, 07:17 PM
  4. Probability of faulty parts shipped. Tough question!
    Posted in the Advanced Statistics Forum
    Replies: 4
    Last Post: May 16th 2009, 11:16 PM
  5. simple question - the last on my assignment! PLEASE :)))
    Posted in the Advanced Statistics Forum
    Replies: 1
    Last Post: April 28th 2009, 09:38 PM

Search Tags


/mathhelpforum @mathhelpforum