Recent Question/Assignment

Assessment item 2
Assignment 2
Value: 20%
Due date: 22-Apr-2016
Return date: 05-May-2016
Submission method options
Alternative submission method
Task
Assessment 2 has 20 marks in total. Marks will be scaled according to the value of the assessment. There are two tasks in assessment 2, Task 1: Processing marks and Task 2: Creating Circle class and testing its properties.
Task 1

For this task you will create a class containing a number of static methods for processing an array of marks, which are scores in a test. Each mark is an integer in the range 0 to 100 inclusive. On the Interact site for this subject, you will be provided with a class Marks, which has a method getMarks that returns an array of marks for you to use in testing.
The class ProcessMarks that you create will have the methods specified below. Most will accept an array of marks as an argument; one will accept an array of characters. The return type should be appropriate for the returned value.
• The max, min and range methods will return the maximum mark, the minimum mark and the difference between the maximum and minimum marks respectively.
• The mean methods will return the mean of the set of marks.
• The median method will return the median value of the set of marks. The median value is the middle one when the values are placed in order. To obtain an ordered version of the marks you may use an appropriate sort method of the Java API’s Arrays class. Be careful not to destroy the original array of marks. If there is an even number of marks, the middle value is taken as the average of the two values that are nearest to the middle.
• The mode method will return the mode of the set of marks, which is the most commonly occurring mark. To find the mode, use an ordered version of the set of marks, as used for finding the median. If there is more than one value that is most common, any one of the most common values will do for the mode.
• The grades method will return an array of characters, which are the grades corresponding to the integer marks in the array of marks. The grades are to be assigned using the following lower boundaries for the corresponding marks: for grade A, the lower boundary is 90; for grade B, it is 75; for grade C, it is 60; for grade D, it is 50; for grade E, it is 45; and F is the grade for all other marks. A best solution for this method would not have the values for the lower boundaries hardcoded but would use an array for these values, which would allow the grade boundaries to be altered.
• The gradeDistn method will accept an array of characters, which are the grades assigned for the array of marks, such as returned by the grades method. The gradeDistn method will return an array of integer values containing the distribution of grades, which is the number of occurrences of each grade in the assigned grades. The characters used for grades are fixed. The returned array should provide the distribution in order from grade A to grade F.

The following points should be taken into account in the design of your program:
• None of your code should change the contents of the original array of marks.
• You should not make any assumption that client code, that would use your methods, should call them in any particular order. That is, you should not assume that a client that calls the range method will have previously called the max and min methods.
Test your ProcessMarks class, either by providing test code in a main method within that class or in a separate class. The test code will use an array of marks obtained from the getMarks method of theMarks class provided on the Interact site. Test each one of the methods described above, displaying the results appropriately. The grades should be displayed 30 per line with a space separator between grades. The grade distribution should be displayed in the form:

A: 10
B: 30
C: 105
D: 75
E: 35
F: 10
Task 2

For this task you will create a Point3D class to represent a point that has coordinates in three dimensions labeled x, y and z. You will then use the class to perform some calculations on an array of these points. You need to draw a UML diagram for the class (Point3D) and then implement the class.

The Point3D class will have the following state and functionality:
• Three fields, x, y and z, of type double, represent the point’s coordinates.
• A no-arg constructor creates a point at position (0, 0, 0).
• Another constructor creates a point with specified coordinates.
• A getter method is provided for each of the fields.
• An accessor method named distance returns the distance between the current point and another point passed as an argument.
• The distance method is overloaded to accept the coordinates of the other point.
Write a TestPoint3D class that will have a main method, and perhaps other methods as required by good design, to test your Point3D class. It will not have user input because this class will stand as a record of the tests you have applied and you will be able to run it whenever you alter your Point3D class. For the TestPoint3D class you will need to do the following:
• Test the basic state and functionality of the Point3D class. Each of the constructors and each of the methods should be tested using some different data values. The test code should display values so that they can be checked.
• Write some code to create an array of at least 10 Point3D objects.
• Write a method max, which will accept the array of points as an argument, and will calculate and display the maximum distance between the points in the array, and the pair of points for which the maximum occurs.
• Write a method min, which will accept the array of points as an argument, and will calculate and display the minimum distance between the points in the array, and the pair of points for which the minimum occurs.
Online submission via Turnitin is required for this assignment. Details will be provided by your subject lecturer.
Rationale
This assignment has been designed to allow students to test and demonstrate their ability to:
• to interpret design requirements expressed in Unified Modelling Language;use method abstraction in program design (objective 2);
• to use object-oriented techniques and Java resources to develop small applications consisting of a number of classes (objective 5);
• be able to apply basic testing and debugging techniques in program development (objective 6);
• be able to implement basic algorithms in Java (objective 1);
Marking criteria
These criteria will be used to evaluate Assignment 2:
• The tasks are performed as specified and the assignment is submitted as required
• Appropriate understanding of the subject area is demonstrated, including correct use of appropriate techniques
• Explanations and discussions are cogent and use clear and correct English expression
• Referencing is used where appropriate
Assessment 2
Task 1
Criteria Marks Pass CR DI HD
a. Execution: Program launches, executes and terminates without crashing; program executes as specified. 1.0 Provide java files. They execute without crashing towards intended output (1.0)
b. Program design & implementation: Classes with the functions: max, min and range methods (2); mean, median, and mode methods (2); grades and gradeDistn methods (2); which show good design and logic (1). 7.0 Implement ProcessMarks class with some functions and then combine it with Marks class for testing (3.5) Implement ProcessMarksclass with majority of the functions and integrate the mark class with it for testing (4 - 6) Implement and integrate classes with all functions by maintaining logical flow (7)
c. Presentation: Code uses good style (indentation, comments) 0.5 Few comments and minor indentation errors (0.25) Proper indentation and comments in each block and major lines (0.5)
d. Submission: the documents with all components (analysis, design, coding, testing, and output) 1.5 Provide sample output (0.75) Provide all components within the specified word length(1.5)
Task 2
Criteria Marks Pass CR DI HD
a. Execution: Program launches, executes and terminates without crashing; program executes as specified. 1.0 Provide java files. They execute without crashing towards intended output (1.0)
b. Program design & implementation: Point3D (3.0) and TestPoint3D (3.0) classes are implemented as specified, showing good logic. 6.0 Implement Point3Dand TestPoint3Dclasses with some functions and combine them for testing (3) Implement and integrate the Point3D andTestPoint3D classes with majority of the functions for testing (4) Implement and integrate thePoint3D andTestPoint3Dclasses with all functions with minor error (5) Implement and integrate thePoint3D andTestPoint3Dclasses with all functions perfectly by maintaining logical flow (6)
c. UML design: For class Point3D. 1.5 UML with all components (0.75) UML with all components and their modifier, argument, and return type with minor error (1.0) UML with all components and their modifier, argument, and return type (1.5)
d. Presentation: Code uses good style (indentation, comments) 0.5 Few comments and minor indentation errors (0.25) Proper indentation and comments in each block and major lines (0.5)
e. Submission: The document with all components (analysis, design, coding, testing, and output) 1.0 Provide sample output (0.5) Provide all components within the specified word length with good explanation (1.0)

Looking for answers ?