Subject Code : COIT20245
Assessment Task:

Introduction
In this assignment, you are to implement a console application that supports simple MAP (Mean Arterial Pressure) analysis functionality. A phased implementation approach is recommended and an outline for such an approach is provided in Appendix 1. The application is to be conformant with the class diagram provided in Figure 1.
The Application
The raw data to be analysed is to be stored in 3 arrays. Use array initialisers to specify initial values of your choosing. The 3 arrays are to contain person identifiers (string values), systolic blood pressure (SBP) and diastolic blood pressure (DSP). Both SBP and DSP are to be specified as int values. MAP is determined from an individual’s blood pressure using the following formula:
MAP = 1.0/3.0 * SBP + 2.0/3.0 * DBP
The raw data is to be used to create objects of type Record, which are to be stored in an array of type Record.
Phase 1. 
Create all classes with members and dummy methods as per the class diagram. Where constructors set member variables via parameters, add code to do this. Leave void methods with an empty body. Where methods require a return value, just return a sensible type-consistent default value, as shown below for the MAPAnalyser public methods: 
public MAPAnalyser() {
    nrecords = 0;
    data = new Record[nrecords];
}
public Record find( String id ) { 
return null; 
}
public int lowest() { 
return 0; 
}
public int highest() { 
return 0; 
}
public int median() { 
return 0; 
}
public Record[] find( int map1, int map2 ) { 
      // no records found
Record[] r = new Record[0]; 
return r; 
}
In the main() method, add the following code: 
MAPAnalyser a = new MAPAnalyser(); 
View v = new View( a ); 
v.commandLoop();        // does nothing
Do not proceed to Phase 2 until this code compiles. You now have an application that compiles but when it runs, no output will be produced. Also, we have not created any records. However, we do have an empty data array, which is an important test case

Phase 2. 
Get the command loop working with the dummy methods. The find methods will be unsuccessful; you will need to explicitly test the return values and display an appropriate message. 
The following commands are recognised
    Display this message                                   > 0
    Display a specific subject record:                     > 1 id
    Display records for all subject records within a range > 2 map1 map2
    Display statistics (minimum, maximum and median)       > 3
    Exit the application                                   > 9
> 1 S01
S01 not found
> 2 70 100
No records in this range
> 3 
Lowest MAP is 0
Highest MAP is 0
Median MAP is 0
> 9 
My preference is for minimalist interaction. You may prefer to display the menu before every command and explicitly prompt for all inputs – either style is fine.
 
Phase 3 

We now need to populate the data array. Note that if we present the data in the arrays in sorted order, we don’t need to write our sorting method just yet. Once the array is populated, you will need to test that it has been set up correctly by displaying its contents. You can do this using the getter methods or with the toString() method. The convention in Java is to make the return value of toString() minimalist, as in <S01,90,120,110,high> - there is no naming of values.
Now that we have a sorted data array to work with, we can implement find(String). This will require you to code the binary search algorithm – use the implementation in Deitel & Deitel as a starting point, but add comments to indicate that you have done this. We can also implement find(int,int), lowest() and highest(). The order in which you tackle these is up to you; I would do lowest() and highest() first.

Phase 4
Finally, we need to do the sorting. First, get sorting by id working. As with binary search, use the implementation in Deitel & Deitel as a starting point, but add comments to indicate that you have done this. Note that while sorting an already sorted list is a sensible test case, you will need to test your code with other data sets. A convenient way to do this is to use the approach employed in the Week 6 Laboratory exercise.
Once you have to sort by id working, then move onto implementing median(). The median is the “middle” value of a sorted list of values, such as house prices. To calculate the median, you will need to sort the MAP values and find the middle value. If there are n values in the array and n is odd then there is 1 middle value, which is the median; its index is n/2. If n is even, there are two middle values and the median is the average of the two values; their indices are n/2 and n/2-1. 
Note that sorting by id is to be done once per session, as find(String) may be invoked multiple times. With sorting by MAP value, the median is likely to be invoked only once per session when the application is in production (as opposed to testing) so whether you embed sorting into the median() method or do it independently of the method is up to you. Also, for sorting by MAP value, no algorithm is specified – you can use either selection sort, insertion sort or Arrays.sort().

This Computer Science Assessment has been solved by our  Computer Science Experts at UniLearnO. Our Assignment Writing Experts are efficient to provide a fresh solution to this question. We are serving more than 10000+ Students in Australia, UK & US by helping them to score HD in their academics. Our experts are well trained to follow all marking rubrics & referencing style.

Be it a used or new solution, the quality of the work submitted by our assignment experts remains unhampered. You may continue to expect the same or even better quality with the used and new assignment solution files respectively. There’s one thing to be noticed that you could choose one between the two and acquire an HD either way. You could choose a new assignment solution file to get yourself an exclusive, plagiarism (with free Turnitin file), expert quality assignment or order an old solution file that was considered worthy of the highest distinction.

Eureka! You've stumped our genius minds (for now)! This exciting new question has our experts buzzing with curiosity. We can't wait to craft a fresh solution just for you!

  • Uploaded By : Ariana
  • Posted on : November 13th, 2018

Whatsapp Tap to ChatGet instant assistance