1. Homepage
  2. Programming
  3. ICT159 Foundations of Programming Assignment 2: Sequence, selection and iteration constructs

ICT159 Foundations of Programming Assignment 2: Sequence, selection and iteration constructs

Engage in a Conversation
AustraliaMurdoch UniversityICT159Foundations of ProgrammingSequenceselection and iteration constructsC

ICT159 Foundations of Programming CourseNana.COM

Assignment 2 CourseNana.COM

  CourseNana.COM

DUE: Please refer to LMS CourseNana.COM

  CourseNana.COM

If you are unsure of anything, you need to get clarification early. So read this document very carefully. CourseNana.COM

  CourseNana.COM

OBJECTIVES: CourseNana.COM

·     Construct algorithms to solve problems using a combination of sequence, selection and iteration constructs. CourseNana.COM

·     Implement such algorithms in a common programming language, C. CourseNana.COM

·     Read/write data to/from files. CourseNana.COM

·     Use arrays of records (structs). CourseNana.COM

·     Search arrays of records. CourseNana.COM

·     Apply the methodology of top-down design to the construction of solutions and implement these solutions in a modular way. CourseNana.COM

  CourseNana.COM

PREREQUISITES: CourseNana.COM

·      Assignment 1 has been attempted, even if not submitted. CourseNana.COM

·      All lab exercises for modular programming, arrays, Files and Data Structures have been completed CourseNana.COM

  CourseNana.COM

Worth: CourseNana.COM

This assignment is worth 20% of the total assessment for the unit ICT159. CourseNana.COM

  CourseNana.COM

Assignment Sections: CourseNana.COM

  CourseNana.COM

Your assignment must contain the following components either in the documentation or as separate electronic files, where indicated: CourseNana.COM

1.      All assumptions made other than those stated in the question that you make about the problem. There will virtually always be assumptions you are implicitly making so think about this very carefully. Also be careful that you do not put in unnecessary assumptions. (5%) CourseNana.COM

2.     Structure chart for your program. Show parameter passing.  (5%) CourseNana.COM

3.     Your algorithm written in a uniform fashion using a pseudocode or a similar style and adhering to the conventions required in the unit. Your algorithm should be presented at an appropriate level of detail sufficient to be easily implemented. Submit your high- level algorithm along with algorithms of your decompositions (refinements) as appropriate to the question. Algorithms that look like the code was written first and then word processed to look like an algorithm would receive no marks.  (20%) CourseNana.COM

4.     A set of test data in tabular form with expected results and desk check results from your algorithm. Each test data must be justified – reason for selecting that data. No marks will be awarded unless justification for each test data is provided. (10%) CourseNana.COM

5.     Source code files (.c and .h) must be submitted and the source code must build (compile and link) to create an executable that operates correctly. Make sure you use the code style required in the unit. No marks awarded if the source code does not build and run. (50%) CourseNana.COM

6.     Results of applying your test data to your final program (tabular form), including a sample printout of your program in operation.  (5%) CourseNana.COM

7.     Self-assessment, which should include (5%) CourseNana.COM

·      How successful you were in achieving the requirements and a discussion of any problems you encountered (2.5%). CourseNana.COM

·      In point form, a summary of what works and what does not work in your program. A false claim here would mean that marks for this component would not be awarded. So make sure that you have tested your program thoroughly (2.5%). CourseNana.COM

  CourseNana.COM

Please submit the sections in order as shown in the assignment template in this document. Marks may be lost otherwise. CourseNana.COM

  CourseNana.COM

Question CourseNana.COM

  CourseNana.COM

This question extends Assignment 1. There is meant to be code reuse from assignment 1 if your design and code from Assignment 1 adheres to the principles of high cohesion and low coupling. CourseNana.COM

  CourseNana.COM

You will know if these principles were adhered to if you are able to reuse most of the modules from Assignment 1. CourseNana.COM

  CourseNana.COM

Before attempting this question, CourseNana.COM

-        please complete the prerequisites listed on the first page of this document. CourseNana.COM

-       Make sure that you have corrected your solution to Assignment 1 following the solution discussed during the lectures (please refer to the recorded videos) CourseNana.COM

  CourseNana.COM

Assignment 2 will require Array of records (structs) with file I/O is needed. CourseNana.COM

  CourseNana.COM

In this assignment, instead of asking the user to input the amount from the keyboard, this time, the program will read its data from a text file named coins.txt. There can be 0 and up to 10 input lines, each line is formatted like the example below: CourseNana.COM

  CourseNana.COM

Jane 30 cents in AU$ CourseNana.COM

Joe  85 cents in EUR CourseNana.COM

Jane 25 cents in AU$ CourseNana.COM

Jane 15 cents in US$ CourseNana.COM

CourseNana.COM

  CourseNana.COM

Names are one-word strings. The same name can be repeated in the data file but the coin values/currencies can be different. If the name is the same, your program must assume it relates to the same individual. CourseNana.COM

  CourseNana.COM

You are asked to write a program that reads the data from this file. For each individual, the program then must add up the coin amounts that belong to the same currency to obtain a total amount for that individual in that currency. It then needs to compute the change to be given for that individual for each of the currencies that that individual owns. CourseNana.COM

  CourseNana.COM

For example, the example input file above indicates that Jane has 30 + 25 = 55 cents in AU$ and 15 cents in US$. The program then needs to calculate how many coins (hereinafter referred to as change) it should give to Jane for the amount it owns in AU$ and for the amount it owns in US$. CourseNana.COM

  CourseNana.COM

You do not covert currencies. CourseNana.COM


The coins we have are the same as Assignment 1:
CourseNana.COM

1) US$, which has four types of coins of 50, 25, 10 and 1 cents  CourseNana.COM

2) AU$, which has four types of coins of 50, 20, 10 and 5 cents CourseNana.COM

3) Euro, which has four types of coins of 20, 10, 5 and 1 cents CourseNana.COM

  CourseNana.COM

The program should aim to give as much of the higher valued coins as possible (same as Assignment 1). Note that the amounts in each line have values from 1 to 99. However, when you sum up the all the lines of an individual, the total for that individual can exceed 99. If the file contains a value that is not in that range, it should display a message saying that the data file has incorrect values and should display the line numbers that contain these incorrect values. CourseNana.COM

  CourseNana.COM

Once your program has read in the data from coins.txt, your program will close coins.txt first, and then show a console screen menu as illustrated below: CourseNana.COM

  CourseNana.COM

1. Enter name
2. Exit
CourseNana.COM

  CourseNana.COM

The program will continue to show the menu and execute the menu options until "Exit" is selected by entering the value 2 at the menu prompt.

When the user enters the value 1 at the menu prompt, your program will ask for a name. As an example, if the user enters the name Jane, the program will output:

Customer:
Jane 55 cents in AU$

Change:
50 cents: 1
5  cents: 1


CourseNana.COM

Jane 15 cents in US$

Change:
10 cents: 1
1  cents: 5
CourseNana.COM


Change values of 0 should not be shown.
CourseNana.COM

  CourseNana.COM

If the user enters a non-existent name (e.g., Donald) at menu Option 1, which would not be in the array of records, your program will print: CourseNana.COM

  CourseNana.COM

Name: Donald CourseNana.COM

Not found CourseNana.COM

  CourseNana.COM

After the output is provided for menu Option 1, the menu is redisplayed. CourseNana.COM


Once the user enters 2 to exit, your program must write the coin, the currency and change data in .csv format for all names present in the file coins.txt to another file called change.csv. After writing the data to the file your program must exit. In change.csv, the data lines for Jane will look as follows, with each value separated by a comma and with the line terminated by newline:

Jane, the change for 55 cents in AU$ is 1,0,0,1 CourseNana.COM

Jane, the change for 15 cents in US$ is 0,0,1,5

So in the example output, Jane has
CourseNana.COM

-       55 cents in AU$: one 50 cent coin and one 5 cent coin. There are no 20 or 10 cent coins. CourseNana.COM

-       15 cents in US$: one 10 cent coin and five 1 cent coins. There are no 50 or 25 cent coins. CourseNana.COM

  CourseNana.COM

The output data file change.csv, if an individual’s name appears more than once inside coins.txt, their name should appear only once per currency inside change.csv (with the accumulated coin amount and change for that currency).

You need to provide a test plan to fully test your algorithm and program, and provide an input data file, coins.txt, that contains test data in the specified format for testing your program.

Your solution (program and algorithm) should be modular in nature. Use a high cohesion and low coupling design.
CourseNana.COM

  CourseNana.COM

Submit a structure chart and a high-level algorithm with suitable decompositions (refinement) of each step (low-level algorithm). CourseNana.COM

  CourseNana.COM

Note that for this problem, the principle of code reuse is very important, and a significant number of marks are allocated to this. You should attempt to design your solution such that it consists of a relatively small number of functions that are as general in design as possible, and you should have functions/subroutines that can be reused (called repeatedly) in order to solve the majority of the problem. CourseNana.COM

  CourseNana.COM

If you find that you have developed a large number of functions (code modules/subroutines) where each perform some similar or overlapping task (or have a lot of code that is repeated in the functions) to other modules/subroutines, then attempt to analyse your design to generalise the logic so that you have just one general version of the module/subroutine. CourseNana.COM

[ICT283 note: This ICT159 approach is one of the approaches used in “Abstraction”. To be able to pass ict283, you need to apply the concept of abstraction to everything you do] CourseNana.COM

  CourseNana.COM

Code re-use is related to cohesion. So, be mindful of the cohesion exhibited by the function (module). So, if you have a function (module) that is doing more than one task, then cohesion is low, and, you will need to redesign to have high cohesion (module does only one thing). CourseNana.COM

[ICT283 note: The above concept that you learnt in ict159 is known as the Single Responsibility Principle and is part of the principles known as SOLID. To be able to pass ict283, you need to apply SOLID to your design of Data Structures and applications using these Data Structures]. CourseNana.COM

  CourseNana.COM

Get in Touch with Our Experts

WeChat WeChat
Whatsapp WhatsApp
Australia代写,Murdoch University代写,ICT159代写,Foundations of Programming代写,Sequence代写,selection and iteration constructs代写,C代写,Australia代编,Murdoch University代编,ICT159代编,Foundations of Programming代编,Sequence代编,selection and iteration constructs代编,C代编,Australia代考,Murdoch University代考,ICT159代考,Foundations of Programming代考,Sequence代考,selection and iteration constructs代考,C代考,Australiahelp,Murdoch Universityhelp,ICT159help,Foundations of Programminghelp,Sequencehelp,selection and iteration constructshelp,Chelp,Australia作业代写,Murdoch University作业代写,ICT159作业代写,Foundations of Programming作业代写,Sequence作业代写,selection and iteration constructs作业代写,C作业代写,Australia编程代写,Murdoch University编程代写,ICT159编程代写,Foundations of Programming编程代写,Sequence编程代写,selection and iteration constructs编程代写,C编程代写,Australiaprogramming help,Murdoch Universityprogramming help,ICT159programming help,Foundations of Programmingprogramming help,Sequenceprogramming help,selection and iteration constructsprogramming help,Cprogramming help,Australiaassignment help,Murdoch Universityassignment help,ICT159assignment help,Foundations of Programmingassignment help,Sequenceassignment help,selection and iteration constructsassignment help,Cassignment help,Australiasolution,Murdoch Universitysolution,ICT159solution,Foundations of Programmingsolution,Sequencesolution,selection and iteration constructssolution,Csolution,