# Math Help - faulty question on assignment

1. ## 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?

2. ## Re: faulty question on assignment

Originally Posted by Jskid
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.

3. ## 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.

4. ## 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

5. ## 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.

6. ## 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.

7. ## 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.

8. ## Re: faulty question on assignment

Originally Posted by Jskid
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

9. ## Re: faulty question on assignment

Originally Posted by Deveno
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?

10. ## 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.

11. ## Re: faulty question on assignment

Originally Posted by Deveno
the point of taking a class is not to "get the homework done", it's to understand the material.
Ideally that's the case