<mosaic.cnfolio.com>
Introduction to Algorithms and Programming – ENG421

ENG421 Feedback comments to students

Academic year 2012/13



Students have individual coursework pages in which they may write notes as they work on practical worksheets and the coursework assignment. They are encouraged to use the commenting feature to write questions as they work. The unit lecturer can post feedback using the same commenting feature. Comments written by each student is private.

The list below contains feedback comments written by the unit lecturer, but, without any student information. It is provided in case other students have similar questions.

Comment 70   by Moderator   @ 1970-01-01 00:00
It is a shock that you've only started to work on the coursework at 1pm today. The original due date was Jan 15 and was extended to Jan 29. Despite that extension, you still could not start working on it until 1pm today - the extended due date. That fact speaks for itself.

Please plan on putting in more effort towards the second coursework and exam. Please attend the lectures and labs to ask questions and get help. See you at lecture on Thursday and at lab on Friday. There is no substitute for effort.
Comment 69   by Moderator   @ 1970-01-01 00:00
Students were suggested to work on identifying one hand at a time. If you are trying to implement the pseudo code lines 81, 83 and 85 - then, there is no need for source code lines 323-440. Work first on implementing line 81, then line 83 and then line 85. One step at a time.
Comment 68   by Moderator   @ 1970-01-01 00:00
Students have been reminded numerous times to solve the problem using pseudo code BEFORE writing source code to implement the solution. Pseudo code is also a requirement for the coursework. The history of saved versions does not show efforts to learn or practice problem solving.

Please review the notes and worksheets. In particular, look at the numerous examples of pseudo code and source code.
Comment 67   by Moderator   @ 1970-01-01 00:00
The history of saved versions for your coursework page is worrying - the first saved version was Jan 18, 2013. That is AFTER the original due date for this coursework and only 11 days before the extended due date. That speaks for itself.

The pseudo code has some partially correct ideas, such as to describe one card. But, there are many inconsistencies and errors with both the structure and the logic.

Without pseudo code to describe a solution, it is difficult to write source code.

It is difficult to learn without efforts to practice writing pseudo code and source code.
Comment 66   by Moderator   @ 1970-01-01 00:00
Work on the pseudo code to identify the score and hand before working on the source code. Work on solving for one hand at a time.
Comment 65   by Moderator   @ 1970-01-01 00:00
The pseudo code at lines 74-113 is the right idea for solving the smaller problem of identifying the score. Next, work on implementing that in code. Then, come back and modify that pseudo code to solve the larger (and last) problem of identifying the hand. At that point, some of the steps in pseudo code lines 114-153 can be integrated into the pseudo code to identify the score. Take small steps by only working to identify one hand at a time rather than attempting to identify all hands at once. Keep up the good work.
Comment 64   by Moderator   @ 1970-01-01 00:00
The usage of the WHILE structure is incorrect in both the pseudo code and the source code. The history of saved versions on your coursework page shows that you used it once in Oct, once in Dec, once on Jan 2 and once on Jan 19. With such a lack of effort, it should not be a surprise that you are not familiar with the WHILE structure. Please read the lecture notes on Control Structures and practice the worksheets to become more familiar with the WHILE structure before attempting to use it with the coursework. There is no substitute for effort.
Comment 63   by Moderator   @ 1970-01-01 00:00
The pseudo code at line 2 is incorrect. We discussed in class the steps to describe one card. Then, we briefly discussed the structure that would be required to describe 5 cards. You need to use an iteration structure to handle 5 cards.

The source code is incorrect at line 120. That error will affect the code that follows. As we discussed in lecture, please do your work in small steps so that you can find errors easier. You can start by making sure that you can implement the pseudo code to describe ONE CARD. When that works, then go on to 2 cards and increasing until the solution can handle 5 cards.
Comment 62   by Moderator   @ 1970-01-01 00:00
Using a loop to automatically move through a list of variables is done by using an array and having the array index value increase or decrease with each loop iteration. There are code examples provided with the lecture notes for arrays and sorting.
Comment 61   by Moderator   @ 1970-01-01 00:00
In addition to saving input values to data variables, the scanf() function produces a value that can be stored or compared. That value is the number of inputs that it found. When, that is put inside a test condition with an IF statement:

if ( scanf( "%d", &number ) > 0 )

That code is similar to asking, "if the number of inputs found is greater than zero". The reason is that when an input is available, then, scanf() will produce a value of 1 and when an input is not available, scanf() will produce a value of zero.
Comment 60   by Moderator   @ 1970-01-01 00:00
The choice to put statements inside an ELSE or outside is dependent on the logic that you are trying to implement for the solution. If the ELSE branch includes a complete IF structure, then, we call that "nested" logic. It means that the second IF structure is only active when the ELSE branch is active. Some, but not all, solutions require "nested" logic. In the case of question 6 in worksheet 1, a solution is possible without using "nested" logic. But, using "nested" logic would produce a more effective (better performance) solution.
Comment 59   by Moderator   @ 1970-01-01 00:00
Comments included with the source code are useful to explain implementation choices.

Write pseudo code that describe the solution at the top of the program.
Comment 58   by Moderator   @ 1970-01-01 00:00
Worksheet 1 has the information about writing sequential, decision and iteration pseudo code structures. There are examples of pseudo code with the lecture notes and review question solutions.
Comment 57   by Moderator   @ 1970-01-01 00:00
I noticed that you did not start to save your work until Nov 29. The pseudo code that you saved during Nov 29 and Dec 11 were mostly using sequential structures. You had mostly the right idea. But, you did NOT use decision structures (IF/THEN/ELSE) or iteration structures (WHILE) with pseudo code. Revisions 13 and 14 showed your attempts to do the parking tariff problem, which required decision structures - BUT, you did not write pseudo code for that problem and did not successfully finish solving the problem. From Dec 12 onwards - the saved versions either did not contain any pseudo code or incomplete attempts.

The implication is that you need to practice the worksheets in order to improve your comfort and understanding of decision structures and iteration structures. Please go back and do the worksheets thoroughly instead of just skipping them.
Comment 56   by Moderator   @ 1970-01-01 00:00
You should use a version of the bubble sort pseudo code that is adapted to your particular pseudo code solution. The algorithm we discussed in class was a generic version using numbers. The coursework involves playing cards. You can use the algorithm from class as a starting point and customise it to fit with your own solution.
Comment 55   by Moderator   @ 1970-01-01 00:00
The pseudo code in revision 19 does not fix the problems I mentioned in comment 5. Please come to lab on Thursday 11-12 or Fri 2-3 and we can discuss it in more details.
Comment 54   by Moderator   @ 1970-01-01 00:00
The pseudo code in revision 19 missed significant requirements specified in the coursework description. Please look again at the coursework description, especially the sample input and sample output.
Comment 53   by Moderator   @ 1970-01-01 00:00
The ideas in comment 1 missed significant requirements specified in the coursework description. Please look again at the coursework description, especially the sample input and sample output.

More worrying is that there is no evidence that you've worked on the worksheets.
Comment 52   by Moderator   @ 1970-01-01 00:00
The ideas in comment 1 missed significant requirements specified in the coursework description. Please look again at the coursework description, especially the sample input and sample output.

More worrying is that there is no evidence that you've worked on the worksheets.
Comment 51   by Moderator   @ 1970-01-01 00:00
One possible solution to your question in comment 5 is to use scanf() to read a character. Then, you can check whether the input character is a digit. When you find a digit, then, you can convert the digit character to its integer value.
Comment 50   by Moderator   @ 1970-01-01 00:00
Where is the pseudo code?
Comment 49   by Moderator   @ 1970-01-01 00:00
Without working on the worksheets, it should not be a surprise that the coursework could be difficult.

Start with the first worksheet. That will give your practice with pseudo code. Read the notes from lecture. Come to lab and ask questions.
Comment 48   by Moderator   @ 1970-01-01 00:00
Use the comments form to make notes for yourself or to ask questions to the lecturer. Do not write pseudo code or source code into the comments.

To write pseudo code or source code, click on the "Edit this page" link in the menu at the top of the page. That changes the page to the programming environment that you see with the worksheets.
Comment 47   by Moderator   @ 1970-01-01 00:00
Without working on the worksheets, it should not be a surprise that the coursework could be difficult.
Comment 46   by Moderator   @ 1970-01-01 00:00
Write your pseudo code for worksheets into your coursework page. Do not put them into the comments forms.
Comment 45   by Moderator   @ 1970-01-01 00:00
Write your pseudo code for worksheets into your coursework page. Do not put them into the comments forms.
Comment 44   by Moderator   @ 1970-01-01 00:00
The pseudo code for the coursework in revision 21 has significant mistakes because it is trying to write a C program using text. The purpose of pseudo code is NOT to duplicate C source code. Please re-read worksheet 1 on using pseudo code. For example, there are no functions or switch statements in pseudo code.

There are some usable ideas in the pseudo code, but, it missed some important coursework requirements. Please re-read the coursework description - especially the sample input and sample output.
Comment 43   by Moderator   @ 1970-01-01 00:00
The pseudo code in revision 19 has the right idea, but, has structural errors such as not closing up the IF blocks.

The source code implentation in revision 19 has significant errors because the if statements are incorrectly using one equal sign (the assignment operator) when it should be using two adjacent equal signs (the equality comparison operator). Did you do any testing? Any testing would have highlighted the errors.
Comment 42   by Moderator   @ 1970-01-01 00:00
Where is the pseudo code?
Comment 41   by Moderator   @ 1970-01-01 00:00
The pseudo code has the right idea at lines 4-53, but, the structure needs to be fixed. The pseudo code after line 53 is difficult to understand. Try writing using words that describe a playing card (e.g. card value, card suit, hand of cards) instead of short variable names (e.g. val1, val2, cla, clak).
Comment 40   by Moderator   @ 1970-01-01 00:00
Where are the pseudo code for the worksheets?
Comment 39   by Moderator   @ 1970-01-01 00:00
When reading input, we can't force the user to write decimal values to a specific precision. We can specify that we want a decimal number, then, test afterwards whether it meets our input requirements.

When printing output, we can use the formatted output options to specify exactly how may digits of precision we want for the output.
Comment 38   by Moderator   @ 1970-01-01 00:00
Write your pseudo code for worksheets into your coursework page. Do not put them into the comments forms.
Comment 37   by Moderator   @ 1970-01-01 00:00
When using Mosaic, the stdin is provided once at the start of the program. The program can control when to read from the stdin by controlling when it calls functions such as scanf().
Comment 36   by Moderator   @ 1970-01-01 00:00
Good work. Keep up with the structure formatting to make it easier to identify the steps and blocks in your pseudo code.
Comment 35   by Moderator   @ 1970-01-01 00:00
The pseudo code in revision 17 is heading towards the right direction for the solution.

IF structures like lines 7-10 are correct. But, there are also mistakes such as lines 23-30.

Think about how you can combine the work of lines 50-96 with the work of lines 97-138.

Then, use white space formatting to make it easier to identify the steps and blocks in your pseudo code.
Comment 34   by Moderator   @ 1970-01-01 00:00
The pseudo code for the coursework missed significant requirements specified in the coursework description. Please look again at the coursework description, especially the sample input and sample output.

More worrying is that there is no evidence that you've worked on the worksheets.
Comment 33   by Moderator   @ 1970-01-01 00:00
After the discussion of arrays this week, do you see a way that arrays could be used for tables?
Comment 32   by Moderator   @ 1970-01-01 00:00
The pseudo code in revision 86 is on heading towards the correct direction for the solution.

"WHILE there are cards" appears at line 7 and again at line 12. Is there a way to describe the purpose of each line so that it is more clearly different from each other?

What is the purpose of the "pidgeonholes" in solving the problem? Is there a way to more clearly describe the steps leading to the solution?
Comment 31   by Moderator   @ 1970-01-01 00:00
Looks like you fixed the error that you were asking about in comment 6. Line 255 of revision 86 correctly saves the result from using the toupper() function.
Comment 30   by Moderator   @ 1970-01-01 00:00
The pseudo code in comment 4 is incorrect in both content and structure. There is no indication of you working on the worksheets. Please work on the worksheets to get practice at writing pseudo code and C programs.
Comment 29   by Moderator   @ 1970-01-01 00:00
Write your pseudo code for worksheets into your coursework page. Do not put them into the comments forms.
Comment 28   by Moderator   @ 1970-01-01 00:00
The pseudo code does not show a solution. For example, line 5 does not show the steps necessary to identify each card. Please ask in lab if you have questions. Have you finished the worksheets? They are important practice for writing pseudo code solutions and C programs.
Comment 27   by Moderator   @ 1970-01-01 00:00
Where is your pseudo code?
Comment 26   by Moderator   @ 1970-01-01 00:00
Instead of searching online, please try to do the worksheets in order and come to lab to ask questions.
Comment 25   by Moderator   @ 1970-01-01 00:00
The logic of the solution is improving, but incomplete. The pseudo code is better in some parts, such as the IF-THEN logic in lines 7-10 and 107-110. But, in many other parts, it is too much like a program instead of trying to describe the solution. It may be better to work on the pseudo code on paper in order to avoid the temptation to write source code just because you are using a compiler environment.
Comment 24   by Moderator   @ 1970-01-01 00:00
There is some slight improvement, but, lines such as 113 and 117 are difficult to understand. Regarding the whole solution, try to describe the whole solution using a modular approach, then, expand on each modular step. For example, compare with the modular approach needed to solve the income tax problem in Worksheet 1.
Comment 23   by Moderator   @ 1970-01-01 00:00
Generally, the pseudo code is improving, especially the IF-THEN structures. There are still errors that cause inconsistencies. For example, compare lines 99-100 and 104-105. There is no END to match the START on line 69.

More importantly, try to replace math symbols with a better description that explains the purpose of the math. For example, look at lines 82, 87, 92, 97, 102, 107 and 112. It would be more clear if each of those steps described the purpose, such as, "IF parking time is between 3 and 4 hours".
Comment 22   by Moderator   @ 1970-01-01 00:00
The general idea is good, i.e. using the output from one step as input to another step. But, think about how to do that within one solution rather than 2 separate steps. Look at the worksheets and review questions for examples of how the output from one step is used as input to a following step.
Comment 21   by Moderator   @ 1970-01-01 00:00
Use the comments form to make notes for yourself or to ask questions to the lecturer. Click on the "Edit this page" link in the menu at the top of the page. That changes the page to the programming environment that you see with the worksheets. Do not write source code into the comments.
Comment 20   by Moderator   @ 1970-01-01 00:00
The pseudo code shows the outline of the solution. But, the structure is too casual, i.e. no capitalization of the key structures and the IF-ELSE structures are incomplete. Let's discuss how to fix them at the next lab session.
Comment 19   by Moderator   @ 1970-01-01 00:00
The pseudo code is written in the correct location and has a clear structure. The solution described in the pseudo code does not match the coursework problem. Re-read the coursework and identify the requirements. For example, there is no "players" involved in the coursework. The program receives 5 cards. That's it. There is no dealer and no players.
Comment 18   by Moderator   @ 1970-01-01 00:00
The pseudo code is improving. Focus on using a more consistent structure (look at Worksheet 1).
Comment 17   by Moderator   @ 1970-01-01 00:00
Write your pseudo code for worksheets into your coursework page. Do not put them into the comments forms.
Comment 16   by Moderator   @ 1970-01-01 00:00
Explore further the idea in your pseudo code at line 77 of revision 12. That will help your solution.
Comment 15   by Moderator   @ 1970-01-01 00:00
Put your pseudo code inside of source code comments. For example: /* START statement END */. The pseudo code should be at the top before the source code.
Comment 14   by Moderator   @ 1970-01-01 00:00
Add these to the "GCC arguments" in the Preferences menu:

-fhosted -std=c99 -Werror -Wfatal-errors -Wall -Wextra -fno-asm

That text should come after the existing text "(c4droid:SRC)"
Comment 13   by Moderator   @ 1970-01-01 00:00
It is not necessary to jump right into the coursework. Use the worksheets to increase your familiarity and comfort with C programming.
Comment 12   by Moderator   @ 1970-01-01 00:00
That is a good start on the pseudo code. Notice the number of times that the step, "Display Full Card Names", appears in your pseudo code. Can you take a different approach in order to avoid having to re-do that step so many times?
Comment 11   by Moderator   @ 1970-01-01 00:00
Put your pseudo code inside of source code comments. For example: /* START statement END */
Comment 10   by Moderator   @ 1970-01-01 00:00
You can store all of your work for the lab worksheets and the coursework here in your coursework page. Use the version control feature to view the previous versions.
Comment 9   by Moderator   @ 1970-01-01 00:00
Good work - in revision 12, it looks like you resolved the error in revision 11.
Comment 8   by Moderator   @ 1970-01-01 00:00
The coursework requires identification of the cards, the card hand and the score for the card hand. It does not involve playing the full game of poker. Please see me during lab to discusss further.
Comment 7   by Moderator   @ 1970-01-01 00:00
Revision 7 is good start on writing pseudo code. The SEQUENCE structure and the steps are easy to read. Keep working on the worksheets so that you have practice with the IF and WHILE structures.
Comment 6   by Moderator   @ 1970-01-01 00:00
A dialog box to remind a user when they browse away from the current page being edited is a good idea. I will try to add that as soon as possible. The autosave feature needs more design consideration, so, I'm not likely to do that soon.
Comment 5   by Moderator   @ 1970-01-01 00:00
Try the code you mentioned in comment 2 and see what happens. Let me know in lab if you have questions about the results.
Comment 4   by Moderator   @ 1970-01-01 00:00
Source code comments start with the /* symbol and end with the */ symbol. It works on multiple lines, so, you can use one pair of symbols to enclose your pseudo code.
Comment 3   by Moderator   @ 1970-01-01 00:00
Use the comments form to make notes for yourself or to ask questions to the lecturer. Click on the "Edit this page" link in the menu at the top of the page. That changes the page to the programming environment that you see with the worksheets. Do not write source code into the comments.
Comment 2   by Moderator   @ 1970-01-01 00:00
Use the comments form to make notes for yourself or to ask questions to the lecturer. Click on the "Edit this page" link in the menu at the top of the page. That changes the page to the programming environment that you see with the worksheets. Do not write source code into the comments.
Comment 1   by Moderator   @ 1970-01-01 00:00
Look at the first input parameter for scanf() and printf() on lines 6 and 7. Compare that to the notes from lecture yesterday or the examples in the worksheets. Look carefully at how the ampersand (&) and percentage (%) symbols are used. Look at where your compound statement begins and ends. Bring line 4 inside of your compound statement.