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

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

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