Coit20256 - data structures and algorithms - write a java


Objectives

- Analyse, develop, and implement software solutions
- Choose and compare appropriate data structures in program design
- Apply classes, inheritance, polymorphism, and exception handling
- Test software implementations to ensure correctness and maintainability

Assignment 1 Specification

Introduction

For this assignment, you will write a Java windowed application to generate a maths speed test that students can use to sharpen their arithmetic calculation skills.

Overview of the application

The program generates a set of ten division questions. To do the test, the user sets the timer off, answers all ten questions and then submits the answers. Upon submission, the program automatically marks the test and displays performance statistics. Here a division question is defined as an integer division problem as Java programming integer division operation, where the result of division is an integer and the fractional part is ignored. For example, 5/2 gives the result 2 instead of 2.5.

The GUI
When the program is first started, the GUI should resemble the one given below.

The GUI components beginning from the top include:
- A top panel that contains a label for the title of the application and a label (invisible on this diagram) to display the timer.
- A middle panel that is divided into three columns. A text area is displayed on the right column of the middle panel. On the left are two sub- panels - one containing labels
for the ten division questions (each label will display a division question) and one containing ten text fields for the user answers.
- A bottom panel that contains a generate button, a start button, a submit button, a reset button and an exit button.

Some details of how the program functions

1. The user must generate the ten division questions before starting the test. Upon pressing the Generate button, ten division questions will be randomly generated and displayed on the panel. Each division problem will be an object of type Division class which contains three class data items -
the two operands of the division and the division result. The text fields are made uneditable so that the user does not start entering answers before pressing the Start button. For simplicity, we assume the two operands (i.e. dividend and divisor) ranges are in 1-50, and 1-10 respectively.

2. When the user clicks the Start button, the text fields are set to editable and the timer is started. The user then can enter answers into the text fields.

3. When the user has completed the test, he/she presses the Submit button and the test is automatically marked. The cells with the correct answers are coloured green and the ones with incorrect answers and invalid entries are coloured red. Score details are displayed on the text area. These include the time taken to complete the test, the number of correct answers, and the score achieved.

4. The formula for calculating the score is as follows:
Raw Score = 200 * (number of correct answers * 2.0) / (Time taken).
The Raw Score is cast to an integer. This is just an assumed simple calculation model. You may notice that the raw score depends on number of correct answer and the test time taken.

5. The Reset button resets the GUI to the state when the program is initially started, that is, as in the first diagram shown.

6. The Exit button terminates the application.

7. There are only three menu items, one under File menu, one under Edit menu and the other one under Help menu. When the user clicks the File → Save menu item, the program will save the data appeared on the text area (including the time taken in the test, number of correct answer, as well as the score achieved) to a text file named TestResult.txt. If the user clicks the Edit→ Reset menu item, the program will re-set the GUI as the Reset button does. If the Help→About menu item is clicked, a message box will pop up.

Division class

The Division class contains the data members of two operands (i.e. dividend and divisor) and the result of division, a constructor with two parameters of operands, as well as a get method to retrieve the quotient from the result of two operands division. As division operation is a typical example where division by zero should be avoided, appropriate exception handling and displaying message should be considered in the class definition. In the application class, a set of two random numbers are generated for Division class constructor as arguments.

Data Structures

- You need suitably named variables to store scores, clock and other variables.
- You will need using an object array that stores 10 Division objects. Each array element is a Division object. Thus 10 division questions are 10 elements of this array.
- You will need to use an inner class for the test timer. You can name the class name of the entire application as MathsChallenge or MathsInterface that contains GUI and main method.

Implementation platform

You will implement your program in Java using either the TextPad Editor (recommended) or NetBeans. NetBeans version 6.9 (or above) is available in University computing labs.

Attachment:- Assignment.rar

Solution Preview :

Prepared by a verified Expert
Data Structure & Algorithms: Coit20256 - data structures and algorithms - write a java
Reference No:- TGS02571303

Now Priced at $60 (50% Discount)

Recommended (91%)

Rated (4.3/5)