Assignment title: Discussion


Purpose
To provide students with the opportunity to apply the knowledge acquired and skills developed during the 11 weeks of the Course. This assignment extends from the learning of the first six weeks in the areas of understanding of primitive data types and the concept of collections (in the form of arrays) as well as structured programming including sequence, selection and repetition to beginning to understand and implement object oriented concepts and basic file input and output as well as sorting algorithms.
Learning Objectives
In the process of this assessment task you will:
• Identify and use the correct syntax of a common programming language (Java);
• Describe program functionality based on analysis of a given program;
• Recall and use typical programming constructs to analyse, design and implement simple software solutions; and
• demonstrate debugging and testing skills whilst writing code.
General Requirements
• Provide evidence of code comprehension skills by answering questions relating to the code provided;
• Complete the analysis, design, implementation and debugging of a small program that is pre-dominantly object oriented in nature;
• Include components of analysis, design, implementation and debugging of code that includes file I/O and sorting algorithms.
Due date: Week 11, Friday, 4pm
Please see the Course Description for further information related to submission date, extensions for assignments and Special Consideration. It is your responsibility to submit the appropriate correct version of your files and assignment and report any issues with upload to Moodle as soon as possible.
Marks: This assignment has a total of 180 marks (ITECH1000) or 200 marks (ITECH5000) and it is worth 20% out of the total assessment.
Authorship: This assignment is an individual assignment and it should be completed by the individual student only. The final submission must be identifiably the work of the individual. To support this, you will be required to demonstrate your working code to your tutor in your tutorial class and explain a selection of your assignment answers.
Resources Provided: The following files are available on your Moodle shell:
• An electronic copy of this assignment
• Sample code – TestingShapesListClass and others - for code comprehension
• Links to relevant Federation University resources
Notes You are strongly advised to keep backup files as you work.
If you use any resources apart from the Course material to complete the assignment, you MUST provide an in-text citation within your documentation and/or code as well as providing a list of references in APA format.
Page
Development of a Program Involving Multiple Classes
Please read through the entire specification PRIOR to beginning work. The assignment should be completed in the stages mentioned below.
Part A – Code Comprehension
A Sample program is provided that creates a list of shapes stored in an array. This program uses classes: Shapes, Square, Rectangle and ShapesList. The main method is in the class: TestingShapesListClass. Conduct a careful examination of this code. Make sure you understand this code as it will help you with your own programming for this assignment. Using the uncommented sample code for classes: Shapes, Square, Rectangle and ShapesList provided, answer the following questions:
1. Draw a UML diagram of each of the Shapes, Rectangle and Square classes using the code that has been provided. Complete this using the examples that have been provide in the lecture slides.
2. Draw a UML diagram of the ShapesList class using the code that has been provided. Complete this using the examples that have been provide in the lecture slides.
3. Add appropriate comments into the file: ShapesList.java to explain all the methods. At a mimimum, explain the purpose of each method. For the more complex methods reading input from a file, sorting the data and exporting data to the file, insert comments to explain the code.
4. Explain what the purpose of the call to hasNextLine() in readFromFile() in ShapesList.java.
5. Briefly explain the code in bubbleSort() in the ShapesList class. What attribute are the shapes being sorted by? Name the sort algorithm that is being used. Explain in words how it works, using an example. Why do we need to use two for loops?
6. Briefly name and describe one other sorting algorithm that could have been used.
7. Explain the use of the return value in the getArea() method in the Rectangle class. What is it returning? Where does the value come from?
8. Examine the lines to open the output file and write the outputString in the ShapesList class:
File file = new File("export.txt");
System.out.println(file.getAbsolutePath()); output = new BufferedWriter(new FileWriter(file)); output.write(outputString);
Where is the output file located? Find BufferedWriter in the Java API documentation and describe the use of this object.
9. In the TestingShapesListClass file, in testrun6, the exportToFile method is called with an argument of
ShapesList.toString(). What is the purpose of the '