We're Open
+44 7340 9595 39
+44 20 3239 6980

CREATE A CLASS CONTAINING A NUMBER OF STATIC METHODS FOR PROCESSING

  100% Pass and No Plagiarism Guaranteed

CREATE A CLASS CONTAINING A NUMBER OF STATIC METHODS FOR PROCESSING

Task

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 the Marks 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

Design a class named Fan to represent a rotating fan. The class contains:

  • Three constants named SLOW, MEDIUM, and FAST with the values 1, 2, and 3 to denote the fan speed.
  • A private int data field named speed that specifies the speed of the fan (the default is SLOW).
  • A private boolean data field named on that specifies whether the fan is on (the default is false).
  • A private double data field named radius that specifies the radius of the fan (the default is 5).
  • A string data field named color that specifies the color of the fan (the default is blue).
  • The accessor and mutator methods for all four data fields.
  • A no-arg constructor that creates a default fan.
  • A method named toString() that returns a string description for the fan. If the fan is on, the method returns the fan speed, color, and radius in one combined string. If the fan is not on, the method returns the fan color and radius along with the string “fan is off” in one combined string.
  • Draw the UML diagram for the class and then implement the class.
  • Write a test program that creates two Fan objects. Assign maximum speed, radius 10, color yellow, and turn it on to the first object. Assign medium speed, radius 5, color blue, and turn it off to the second object. Display the objects by invoking their toString method. 
     

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

    Marking guide specific to tasks:

 

Assessment 2 (Total marks 20)

 

Task 1 (total marks 10)

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 ProcessMarks class 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 (identifier naming, indentation, header and inline 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, testing, and output)

1.5

Provide sample outputs (0.75)

Provide all components within the specified word length(1.5)

Task 2 (total marks 10)

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: Fan (3.0) and TestProgram (3.0) classes are implemented as specified, showing good logic.

6.0

Implement Fan and TestProgram classes with some functions and combine them for testing (3)

Implement and integrate the Fan and TestProgram classes with majority of the functions for testing (4)

Implement and integrate the Fan and TestProgram classes with all functions with minor error (5)

Implement and integrate the Fan and TestProgram classes with all functions perfectly by maintaining logical flow (6)

c.     UML design: For class Fan.

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 (identifier naming, indentation, header and inline 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

1.0

Provide sample outputs (0.5)

Provide all components within the specified word length with good explanation (1.0)

             

 

Presentation

Materials to submit for Assignment 2: 

You need to submit a single zip file containing ALL of the required assignment documents including the java and class files as well as the test documents.

Requirements

To complete this assessment you might need to have covered material up to and including the topic 


100% Plagiarism Free & Custom Written,
Tailored to your instructions


International House, 12 Constance Street, London, United Kingdom,
E16 2DQ

UK Registered Company # 11483120


100% Pass Guarantee

STILL NOT CONVINCED?

View our samples written by our professional writers to let you comprehend how your work is going to look like. We have categorised this into 3 categories with a few different subject domains

View Our Samples

We offer a £ 2999

If your assignment is plagiarised, we will give you £ 2999 in compensation

Recent Updates

Details

  • Title: CREATE A CLASS CONTAINING A NUMBER OF STATIC METHODS FOR PROCESSING
  • Price: £ 109
  • Post Date: 2018-11-09T11:08:04+00:00
  • Category: Assignment
  • No Plagiarism Guarantee
  • 100% Custom Written

Customer Reviews

 CREATE A CLASS CONTAINING A NUMBER OF STATIC METHODS FOR PROCESSING CREATE A CLASS CONTAINING A NUMBER OF STATIC METHODS FOR PROCESSING
Reviews: 5

A masterpiece of assignment by , written on 2020-03-12

This is my second order which I booked recently at Insta Research. I just got my coursework completed expertly. Just waiting for good scores now.
Reviews: 5

A masterpiece of assignment by , written on 2020-03-12

My psychology assignment just came on time and the overall quality is good. It’s also free from errors. I simply loved it!