U08026 further object oriented programming
Oxford Brookes University U08026 Further Object‐Oriented Programming
Coursework 2 (35 marks): Bar Charts
Revision History
Version 3: Released after internal moderation. Explicit statement of deadline added (already visible in Moodle)
Individual work
Introduction
In this coursework you must design, implement, test and document an application in Java to display bar charts. Your application must feature a graphical user interface.
You must write classes for a NetBeans project that uses JavaFX to create a graphical user interface. You must design, implement, test and document a program in Java that fulfils all the functional requirements (FR) and all the non‐functional requirements (NFR) indicated below.
You must document all of this in a report. The report must include neatly formatted copies of your Java source
and evidence of your testing, including screen images from your running program. In your report you must reflect honestly on the degree of success you have achieved.
The marking will be done on the basis of your report alone. It must not be necessary for the marker to investigate your program files.
Learning outcomes covered
- Create and test a software artefact by applying the principles of object orientation such as inheritance and interfaces and language features such as exception handling.
- Evaluate the correctness and usefulness of a software system.
- Analyse a complex problem, structure it, collect relevant information, consider options and recommend a course of action.
- Identify and utilise trustworthy information sources which provide programming‐language‐specific reference material.
Advice
We advise you to develop your program step by step, covering each of the functional requirements one at a time and respecting the non‐functional requirements as you proceed.
Functional Requirements
FR1 None of the panes in your interface should be resizable.
FR2 The program must create a pane that is functionally equivalent to (but not necessarily identical to) that of Figure 1. (See section headed Figures)
The following functional requirements pertain to the option: Generate Bar chart.
FR3 |
The program must allow the user to input text to the fields labelled Title, X‐Axis label and Y‐Axis label. This is illustrated in Figure 2. |
FR4 |
The values input to the text fields labelled Title, X‐Axis label and Y‐Axis label must be read by the program and used to annotate the charts it creates. |
FR5 |
The program must allow the user to click on the check boxes headed Enabled in the figures. In Figure 1 the topmost of these is already enabled. |
FR6 |
Clicking on a check box must make the corresponding text fields alongside it, headed Item Name and Value, become available for user input. |
FR7 |
The program must allow the user to input text to the fields labelled Item Name and Value. See Figure 3. |
FR8 |
The program must read the values input to the text fields labelled Item Name and Value. See Figure 3. |
FR9 |
If the user now clicks on the button labelled Generate Bar Chart, the program must use the values that have been entered into the text fields labelled Item Name and Value to create a bar chart. The axes of the chart must be scaled suitably to make the chart fit the pane. See Figure 4. There is no particular significance to the colours used in this or any other of the charts. |
The following functional requirements pertain to the option: Generate From CSV.
FR10 If the user clicks on the button labelled Generate From CSV (without needing to enable any check boxes or input any text) the program must present the user with a means of selecting an existing file in comma‐separated‐value format (csv) and must then create a bar chart from the values held in the file. See Figure 5.
The format of the csv file is shown under the section headed File Format. The csv file used to create Figure 5 is provided along with this specification as the file named: supermarket_marketshare.csv. Its content is shown in the section named File Example.
Your program must work correctly for any correctly formatted csv file. You must show evidence of this in your report for at least one file in addition to the provided file.
FR11 If the file cannot be found, or is not in the correct format, the program must indicate an error by some means that is visible to the user. As an example, Figure 6 shows how this can be achieved for a variant of the file supermarket_marketshare.csv that has “xxx” in the cell for Tesco’s market share, where there should be a number.
Non‐functional Requirements
NFR1 The program must be written in Java.
NFR2 The graphical user interface must be created using JavaFX.
NFR3 The code produced must respect standard Java naming conventions for classes, variables, and methods and must also respect the Java programming guidelines for this module. See the Java Conventions and Programming Guidelines document on this module’s Moodle site.
NFR4 The code must make appropriate use of object‐oriented programming concepts.
NFR5 The code must make appropriate use of exception‐handling features.
NFR6 Your code must be easy to understand, and no more complicated than is necessary. See Java Conventions and Programming Guidelines.
NFR7 Your code must be economical and not unduly repetitive. You must make appropriate use of loops and methods to avoid unnecessary repetition of code.
NFR8 Your program must use anonymous classes or lambda expressions for handling button‐press events. Marking scheme
Up to 35 marks are awarded for this coursework according to the following scheme (the overlap in the mark bands is deliberate).
Mark‐band |
Criteria |
30–35 |
An excellent submission. All functional and non‐functional requirements met. Perfect programming style. Intelligent use of object‐oriented techniques. Good testing and reflection. |
25–30 |
All functional requirements met, and good testing, but slightly inelegant code, or a poor reflection. |
20–25 |
Minor errors in attempts to meet functional requirements and/or testing, or very bad code. |
15–20 |
Major errors to meet some of the functional requirements or in the testing. |
0–15 |
Major errors or omissions in all functional requirements and testing. |
File Format
Row 1: |
Title |
Y‐Axis label |
X‐Axis label |
Row 2 onwards: |
Item Name |
Value |
File Example
Content of supermarket_marketshare.csv
Supermarket Market Share |
Share (%) | Supermarket |
Tesco |
xxx | |
Sainsbury's |
17 | |
Asda |
16 | |
Morrisons |
12 | |
Co‐op |
7 | |
Aldi |
6.5 | |
Waitrose |
5.5 | |
Lidl |
5 | |
Iceland |
3 |
Useful materials
JavaFX Checkbox: https://docs.oracle.com/javase/8/javafx/api/javafx/scene/control/CheckBox.html
Oracle tutorial: https://docs.oracle.com/javafx/2/ui_controls/checkbox.htm
Potentially useful properties/methods:
- selectedProperty().addListener (ChangeListener<Boolean> listener)
- setDisable(boolean value)
- isSelected()
FileChooser: https://docs.oracle.com/javase/8/javafx/api/javafx/stage/FileChooser.html
(Consider reading the details at the top of the Javadoc...)
Potentially useful methods:
- setTitle(String title)
- showOpenDialog(Window ownerWindow)
Figures
Figure 1
Figure 2
Figure 3
Figure 4
Figure 5
Figure 6