Static methods for processing an array of marks

Assignment Help Basic Computer Science
Reference no: EM13934514

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
Value: 10 marks

For this task you have to define a class Circle2D to represent a circle with a point in two dimensions labeled x and y and a radius. To test Circle2D class you also need to define a test class. The Circle2D class has the following state and functionality:
Two double data fields named x and y that specify the centre of the circle with getter methods.
A data field radius with a getter method
A no-arg constructor that creates a default circle with (0, 0) for (x, y) and 3 for radius.
A constructor that constructs a circle with the specified x, y, and radius.
A method getArea() that returns the area of the circle
A method getPerimeter() that returns the perimeter of the circle
A method contains(double x, double y) that returns true if the specified point (x, y) is inside this circle
A method overlaps(Circle2D circle) that returns true if the specified circle overlaps with this circle.
Draw the UML diagram for the class and then implement the class. Write a test class program that creates a Circle2D object c1(new Circle2D(2, 2, 2.5)), display its areas and perimeter, and display the result of c1.contain(3,3), c1.containes(new Circle2D(4, 5, 8.5)), and c1.overlaps(new Circle2D(3, 5, 0.3)).
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
be able to implement basic algorithms in Java

Reference no: EM13934514

Questions Cloud

Graphical social network system with a centralised server : If you elect to work as a pair then equal marks will normally be given to both parties but the module leader reserves the right to reduce the marks for a contributor if it is clear there has been an imbalance of effort.
General ledger accounts related to inventory : Place Y (Yes) beside the general ledger accounts related to inventory in a job order cost system and N (No) by those that are not.
What is the ionization state of each residue at ph5.2 : The active site of lysozyme contains two amino acid residues essential for catalysis: Glu35 and Asp52. The pka values of the carboxyl side chains of these low residues are 5.9 and 4.5 respectively. What is the ionization state (protonated or deprot..
What is the maximum profit and loss for position : An investor purchases a stock for $45 and a put option for $.85 with a strike price of $41. The investor also sells a call option for $.85 with a strike price of $54. What is the maximum profit and loss for this position?
Static methods for processing an array of marks : 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 p..
Zero coupon treasury bonds are currently selling : The U.S. 5-years zero coupon Treasury bonds are currently selling at $791,031.15. No payments will be made until the bond matures 5 years from now, at which time it will be redeemed for $1,000,000. What annualized interest rate would you earn if you ..
find the minimum and maximum values in s : Given an array s =(s[1], s[2], . . . , s[n]), and n = 2^d for some d = 1. We want to find the minimum and maximum values in s. We do this by comparing elements of s.
What property of water gives rise to capillary action : The antibiotic, polymyxin B, attaches itself to the phospholipids in the bilayers of bacterial cells and increases the permeability of the membrane. What is a likely result that this antibiotic will have on bacterial cells?
Would it be the availability of credit : What is tipping theory? how would you apply it to any part of our economy? Most important, where does it start? For instance, if you apply the theory to the auto industry, then what would tip new car purchases? Would it be the availability of credit?..

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Pvss has ever conducted an audit

Your project lead has asked you to determine if PVSS has ever conducted an audit. After further investigation of the situation, you determine that this will be the first review that PVSS has conducted or to which it has been subjected. Your pr..

  Consider a 2-dimensional mesh

Consider a 2-dimensional mesh with n^2 nodes. The shortest distance that a message travels in the mesh is 1 link; the longest distance is 2(n-1) link

  Suggest at least five (5) expected business benefits

Suggest at least five (5) expected business benefits that Especially for You Jewelers company might derive from a new system. Provide a rationale for your suggestions. Propose at least five (5) system capabilities for the company. Provide a rationale..

  Sums each row in the array and displays the results

A. Write code that sums each row in the array and displays the results.

  Generated by some condition that occurs as a result

Program: Generated by some condition that occurs as a result of an instruction execution, such as arithmetic overflow, division by zero, attempt to execute an illegal machine instruction, and reference outside a user's allowed memory space.

  Design a scheme to prevent messages from being modified

Random J. Protocol-Designer has been told to design a scheme to prevent messages from being modified by an intruder.

  The program should contain a function with one of its

write a program that reads a string and outputs the number of times each lowercase vowel appears in it. the program

  Preferred storage method for vsphere

For this discussion, select your preferred storage method for vSphere and explain why this is your preferred method.•Is one storage method easier to configure and support than another? If so, which one do you feel is easier? Explain what separates th..

  What does a java class contain

What does a Java class contain that identifies it as a Java application?

  Local college has tasked you to develop a database

Suppose a local college has tasked you to develop a database that will keep track of students and the courses that they have taken. In addition to tracking the students and courses, the client wants the database to keep track of the instructors..

  Algorithm to place cell phone base station along road

You wish to place cell phone base stations at certain points along road, so that every house is in four miles of one of base stations.

  Major steps of the process maria will have to oversee

Which documents should Maria read before her class? Based on what you know about ISO 27000 program certification, what are the major steps of the process Maria will have to oversee?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd