COIT20245 Assignment 2 1. Introduction In this assignment

Enactment 2
1. Introduction
In this enactment, you are to tool a relieve impression that maintenances unsophisticated BMI (Substance Mass Index) separation functionality through a dispose attached BMIAnalyser. A faced toolation advance is recommended; attribute to Appendix 2 repress exalt details.
2. The Impression
The facts to be analysed is to be loaded from 3 accoutres comprehending special identifiers, elevations (in metres) and gravity (in kgs) using the loadFromTables() collocateify granted in Appendix 1. Loading involves the falsehood of views of referableion Annals from each facts triple (id[i], elevation[i], gravity[i]). These are to be stored in an accoutre of referableion Annals attached facts. The greatness of this accoutre is to be the identical greatness as the facts accoutres. During loading, the BMI repress each special is adapted, using the restraintthcoming repressmula:
BMI = gravity / (height*height)
where gravity is in kilograms and elevation is in metres. The selfidentical predicament is then attached as follows:
Predicament (kg/m2)
from to
Very severely undergravity 15
Severely undergravity 15 16
Undergravity 16 18.5
Normal (salubrious gravity) 18.5 25
Overgravity 25 30
Fleshy Dispose I (Moderately fleshy) 30 35
Fleshy Dispose II (Severely fleshy) 35 40
Fleshy Dispose III (Very severely fleshy) 40
This completionocation is to be granted as a disunited (private) collocateify attached disposeify() that is referable granted in Appendix 1. The principle repress loading is granted in Appendix 1 as the collocateify loadFromTables().
In collocateify to smooth inquiry, facts is to be maintained in ascending collocateify of special id. Conditioning is to be effected subjoined loading, using a collocateify attached conditionById(). This collocateify must tool the augmentation condition algorithm. Referablee that loadFromTables() and conditionById() are to be invoked from the composer repress the BMIAnalyser dispose
The impression’s View dispose is to consummate (using a switch proposition) the restraintthcoming charge options:
1. Show the annals repress a bounded special
2. Show annalss repress completion specials with BMI prizes among a bounded collocate.
3. Show the reserve, ultimatum and mean BMIs
4. Exit the impression
As it is a relieve impression, the manifestationr procure insufficiency to be apted to penetrate a charge and its reasonings (if any). My specialal choice is repress a minimal interaction device, as professionn beneath: run:
The restraintthcoming charges are recognised
Show this referable attributable attributableice 0
Show a separateicular theme annals: 1 themeID
Show annalss repress completion theme annalss among a collocate 2 bmi1 bmi2
Show statistics (minimum, ultimatum and mean marks) 3
Exit the impression 9
1 S01
S01,1.8,80.0,24.7, Normal (salubrious gravity)
Melody that
1. Each charge is determined a reckon
2. Charge 1 insist-upons a separate reasoning – the theme id
3. Charge 2 insist-upons 2 reasonings – the inferior and excellent congauzy of a collocate of BMI prizes
4. I entertain external a “help” charge (charge 0)
5. The charge options are showed at the begin of the impression and whenever a “help” charge is penetrateed, rather than than subjoined each charge.
6. Annalss are showed with no sense of the fields
Feel detached to iteme the over device or if you advance, tool a further tedious interaction device.
Repress the charges that insist-upon reasonings ( i.e. charge 1 and charge 2), referablee that
a. Repress charges 1 and 2, basic blunder checking is expected. Repress charge 1, an blunder referable attributable attributableice is to be showed if an id does referable continue. Repress charge 2, an blunder referable attributable attributableice is to be showed if a component of the collocate is 0 or 100 or if the remedy component of a collocate is close than the original component.
b. Repress charge 2, the collocate is restricted of the prizes bounded. Consequently, having twain components of a collocate correspondent is to be flagged as an blunder.
c. Repress charge 1, binary inquiry is to be manifestationd.
d. Repress charge 2, the results are to be stored in an AccoutreSchedule repress show
The impression must consent to the dispose diagram of Figure 1, although joined privy components and collocateifys are unreserved.
Figure 1. Dispose Diagram
Melody that in Figure 1, the appearance of dispose collocateifys and attributes are determined as + (public) and – (private). Friendships are annotated with a transcribe (repress readability) and reiter-ation. The reiter-ation captures the reckon of view instances that can be confused in the friendship. In this theme, solely couple prizes completionot – 1 and *, which instrument frequent.
3. Dependence
You are to resign a zipped folder comprehending
• The indelicate .java improves that comprehaim your impression. Alternatively, if you entertain manifestationd NetBeans, this can be replaced with a zipped contrivance folder. Details of how to do this are granted in the NetBeans FAQ on the item website.
• Repute.docx. This improve comprehends a ordeal repute that involves tyro call, tyro ID reckon, item call, item principle, a ordeal project and ordeal results. The ordeal project is to comprehaim a schedule of the input prizes that you entertain manifestationd to ordeal the program, the expected output prizes and the legitimate output prizes breedd by your program. The ordeal results are screenshots to profession that that the program breeds the legitimate outputs professionn in the ordeal project.
Melody that owing BMI is adapted as a unordered theme-matter prize, we can’t (in unconcealed) ordeal it repress correspondentity. What this instrument in suppliess of your ordeal project is that you do referable insufficiency to ordeal the predicament aim theme-matters – completion you insufficiency to do is to breed individual be of inputs (and the selfidentical output) per predicament. In generating these inputs, you may experience a BMI calculator, such as serviceable. Referablee that markers procure manifestation their enjoy ordeal facts when ordealing your enactment.
4. Marking Criteria
1 Functionality: Enactment2 dispose (2 marks)
Construction of views as per spec /2
2 Functionality: View dispose (3 marks)
Charge loop toolation /2
Composer toolation /1
3 Functionality: Annals dispose (2 marks)
Constructor, getters toolation /2
4 Functionality: BMIAnalyser dispose (13 marks)
Experience annals by id (0 if binary inquiry referable manifestationd) /3
Experience annalss by collocate of BMI /3
Experience lowest BMI /1
Experience chief BMI /1
Experience mean BMI /1
Condition annalss (0 if augmentation condition referable manifestationd) /3
Calculate predicament /1
5 Coding Phraseology (5 marks)
Program logic /1
Spacing and multitude conventions /1
Naming conventions /1
Comments /2
6 Repute (5 marks)
Ordeal project /3
Ordeal results /2
Sub-Completion /30
Does referable compile/run: 25-30 marks
Late dependence : 5% (1.5 marks) / day or separate of a day
Completion /30

Appendix 1
The principle repress the BMIAnalyser. loadFromTables() collocateify (which is to be attached from the BMI Analyser composer) is as follows:
privy unfilled loadFromTables() { String[] themes = {
// your prizes go here
double[] elevation = { // your prizes go here
double[] gravity = { // your prizes go here
narchives = themes.length; facts = novellightlightlightlight Annals[nrecords]; repress (int i = 0; i nrecords; i++ ) { inclose v = gravity[i]/(height[i]*height[i]);
String c = disposeify( v );
Annals r = novellightlightlightlight Annals( themes[i], elevation[i], gravity[i], v, c );
data[i] = r;
Appendix 2
It is cheerful-natured-tempered-tempered habit to expand an impression incrementally. The referableion is that the performance is mild up into faces, with each face producing a performanceing scheme. Exaltmore, if a face involves the supplies of multiple functionalities, as in Face 3 beneath, these should to-boot be tackled incrementally. The custom of this advance is that you entertain a succession of performanceing schemes that you can evidence to the customer. In your theme, it instrument that you can frequently resign a performanceing scheme, albeit individual may-be with poor functionality. Repress this to performance correctly, you insufficiency to rescue copies of your performanceing accounts as you go. This habit of doing things is such a cheerful-natured-tempered-tempered referableion (chiefly repress team expandment) that software maintenance is antecedentlyhand available in the repressm of account repress schemes such as SVN, GIT, CVS absence of wonder. However, we don’t bring-in you to account repress until later in your manner.
In suppliess of how you energy face this enactment, beneath is how I went environing it, fond that I was performanceing from a dispose diagram. Arguably, it would be emend to begin with Face 2 and entertain an judicious impression that produces output. I didn’t do this as Face 1 is sincere and considerable of it is insufficiencyed repress Face 2 anyway.
Face 1.
1. Create completion disposees with components and dummy collocateifys as per the dispose diagram. Where composers be component variables via parameters, append principle to do this. Leave unfilled collocateifys with an leifirm substance. Where collocateifys insist-upon a requite prize, upright requite a appreciable referableionconsistent want prize, as professionn beneath repress the BMIAnalyser common collocateifys:
common Annals experience( String sid ) {
requite novellightlightlightlight Annals ( sid, 0, 0, 0, -none- );
common inclose lowestBMI() { requite 0.0;
common inclose chiefBMI() { requite 0.0;
common inclose meanBMI() { requite 0.0;
common AccoutreSchedule Annals experience( inclose bmi1,inclose bmi2 ) { AccoutreSchedule Annals alr = novellightlightlightlight AccoutreSchedule (); alr.add( novellightlightlightlight Annals ( -S01-, 0, 0, 0, -none- ) );
alr.add( novellightlightlightlight Annals ( -S02-, 0, 0, 0, -none- ) ); requite alr;
We could entertain requiteed void repress the collocateifys that requite view attributeences, barring I chose to requite star subordinately further animated. Bear in spirit that if experience(String sid) is vain, requiteing void is a cheerful-natured-tempered-tempered habit to evidence scarcity and you procure homeperformance aid referablewithstanding insufficiency to ordeal repress this. In the theme of experience(inclose bmi1, inclose bmi2), there are couple appreciable choices – either requite void or requite an leifirm schedule on scarcity. To-boot referablee that you procure entertain to involve any tenor propositions that are insufficiencyed.
2. In the main() collocateify, append the restraintthcoming principle:
BMIAnalyser a = novellightlightlightlight BMIAnalyser(); View v = novellightlightlightlight View( a );
Do referable returns to Face 2 until this principle compiles. You now entertain an impression that compiles barring when it runs, no output procure be effected.
Face 2.
Get the charge loop performanceing with the dummy collocateifys. You procure insufficiency to procure legitimate getter collocateifys repress the Annals dispose. You energy experience it aidful to transcribe some privy aider collocateifys, e.g.
privy String aid() { requite
-The restraintthcoming charges are recognised -+
– Show this referable attributable attributableice 0 -+
– Show a separateicular theme annals: 1 themeID -+
– Show annalss repress completion theme annalss among a collocate 2 bmi1 bmi2 -+
– Show statistics (minimum, ultimatum and mean marks) 3 -+
– Exit the impression 9- ; }
and may-be show collocateifys repress charges 1,2 and 3.
When I did this with our dummy ordealing collocateifys, the restraintthcoming output was breedd:
The restraintthcoming charges are recognised
Show this referable attributable attributableice 0
Show a separateicular theme annals: 1 themeID
Show annalss repress completion theme annalss among a collocate 2 bmi1 bmi2
Show statistics (minimum, ultimatum and mean marks) 3
Exit the impression 9
1 xxxx
2 0 100
S02,0.0,0.0,0.0,nindividual 3
Lowest BMI is 0.0
Chief BMI is 0.0
Mean BMI is 0.0
BUILD SUCCESSFUL (completion season: 58 remedys)
Melody I entertain showed annalss very tersely; you procure insufficiency to at smallest append component calls. To-boot, the interaction is minimalist. You may pattribute to show the menu antecedently full charge and evidently apt repress completion inputs – either phraseology is gauzy.
Face 3
We now insufficiency to
1. populate the bmi analyser with facts using the principle granted
2. shift the pertinent bmi analyser collocateifys to manifestation this facts rather than upright requiteing dummy prizes as in Face 2.
Melody that
1. we can do the shifts individual at a season, fostering dummy collocateifys repress the charges that we are thus-far to performance on.
2. generating statistics procure be the identical regardclose of whether the annalss are in conditioned collocateify (they are to be conditioned according to theme id) so that is a cheerful-natured-tempered-tempered (and unconstrained) settle to begin.
Face 4
Ordeal the impression. Make firm that blunder checking (as requested) performances. To-boot shift the facts to bring-in edge themes. E.g. what procure happen with 0 annalss? Individual annals? Absence of wonder.