Write application that uses interactive gui based on jframe

Assignment Help JAVA Programming
Reference no: EM131045060

Assessment item 1

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

Assessment Task

In this assignment, you are required to write a Java Application that uses an interactive Graphical User Interface (GUI) based on the JFrame class using SWING GUI components. You will also be designing and implementing the software solution using appropriate data structures and application of classes, inheritance, and exception handling. The case study for developing a solution is given below.

The food consumption of a person is to meet the daily energy requirements. The energy requirement is estimated using a person's age group, gender, height, weight, Basal metabolic rate (BMR), and physical activity level (PAL). There are data available on estimated energy requirements for various PALs, and BMR. So by choosing the correct age group, gender, height and PAL, the energy requirements can be found from the data set. Your task is to develop a Java Application that lets the user to enter height and choose gender, age group, and the most suitable PAL so that the application displays the energy requirements in Mega Joules. The application should contain a GUI as shown below. The GUI components should consist of the following panels.

1. A top panel that contains four (4) Text Fields, one Password Field, two Combo Boxes (drop down list), seven Labels, and two Radio Buttons and a Login command button.

2. A middle panel that contains a Text area to display the user's estimated energy requirement details.

3. A bottom panel that contains four Buttons which are "Load Data" Button, "Display Energy" Button, "Clear Display" Button and "Quit" Button.

The functions of four buttons are described below.

1. Load Data

Initially the ‘Load Data' Button remains disabled as shown in Figure 1. To enable it the user enters the name and password using the fields on the GUI, and clicks the

Login button. The Load Data Button can be used to read the data file which contains height, weight, BMR, and energy requirements for various PALs for males and females in the age groups of 19-30, and 31-50. After loading the file, fill the Combo Box with the description of PAL as given in the table below. Also, the Age group Combo Box is filled with the list of age groups read from the file. One row in

Table 1 PAL Description and Value

Description

Value

bed rest

1.2

very sedentary

1.4

light

1.6

moderate

1.8

heavy

2

vigorous

2.2

the file contains data for one age group, but for both genders.

Note: Use the given data file named COIT20256Ass1Data.csv available on the course website and it contains the set of data.

6_Initial Screen Display.jpg

Figure 1: Initial Screen Display

2. Display Energy

Before clicking on the "Display Energy" button, the user has to enter his/her height in the Text Field, choose the gender by clicking the Radio button and select the age group. This should display the ‘Expected Average Weight' for that height in the Text Field as provided in the file. When user clicks ‘Display Energy' after selecting a suitable PAL from the drop down list, the corresponding PAL number should be displayed on the Text Field and energy requirements in the Text Area.

3. Clear Display

Clicking on the "Clear Display" button should clear all contents from the display area and set the Text Fields and Combo Boxes to their default values.

150_Initial Screen Display1.jpg

Figure 2: Screen Display After Load Data

220_Initial Screen Display2.jpg

Figure 3: Screen Display on Clicking "Display Rosters"

4. Quit

The "Quit" button should allow the user to exit from the application.

Data Structures.

You can use the classes given below as a guideline for your design.

1. enum PAL - Physical Activity Level: The descriptions and corresponding values of PALs are modelled as an enum. This is already completed and provided for your use in the course website in file, PAL.java

2. PALdata class
This is to store the PAL and corresponding energy requirement. This class is already completed and provided for your use in the course website in file, PALdat.java

3. BMRdata class
The purpose of this class is to store the values of age group, gender, height, weight, and bmr read from each row of the file.
a) Include appropriate fields to store:
Height, weight, bmr which are real numbers to be stored in float data type, age group and gender which are strings.
b) A constructor and necessary accessor and mutator methods to get and set values
c) A toString() method that displays the BMRdata attributes.

4. EnergyData Class
a) This class should have the fields to store:
BMRdata, and set of energy needs for various PALs corresponding to the BMRdata. This could be stored as an ArrayList of PALdata.
b) It should also include constructor, mutator, and accessor methods,
c) A toString() method for displaying the stored data.

5. User class - an abstract class
a) This class should have fields to store user entered values such as name, gender, age group, and height.
This class should have:
b) Constructor, accessor and mutator methods.
c) A toString() method for displaying the User details.

6. UserEnergyNeeds class
a) This class extends the User class. This class should have a member fields to store expected average weight, bmr corresponding to the user's age group, gender and height, and the PALdata to store chosen PAL and corresponding energy requirement. The height entered should be between 1.5 and 2m inclusive. Use validation and exception handling to handle this error.

7. GUI Components class
a) This class should have the GUI components listed above.
b) It should have the methods to set up the GUI components and the event handling methods.
c) This class should have method to read data from the file and load data structures appropriately.
d) This also contains main method.

5. Software Tools for Building the Application

You can build your application using the TextPad Editor or NetBeans. It is highly recommended that you create the GUI components using code rather than 'designer' and 'click and drag' of the NetBeans. This creates code which is not maintainable. Remember this is a good prototyping tool, but not recommended for coding.

Assessment item 2

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

Assessment Task

Part A

In this assignment, you are required to write a Java Application that uses an interactive Graphical User Interface (GUI) based on the JFrame class using SWING GUI components. You will also be designing and implementing the software solution using appropriate data structures and application of classes, inheritance, and exception handling. The case study for developing a solution is given below.

The food consumption of a person is to meet the daily energy requirements. The energy requirement is estimated using a person's height, weight, Basal metabolic rate (BMR), and physical activity level (PAL). There is data available on estimated energy requirements for various PALs, and BMR. So by choosing the correct height and PAL, the energy requirements can be found from the data set. In Assignment One you have developed a Java Application that lets the user to enter height and choose the most suitable PAL and thereby display the energy requirements in Mega Joules.

In this assignment you extend your first assignment so that the user can save the user details of name, height, age group, gender, PAL level, energy requirement, and expected weight to a database table named userEnergy. Also your application should display all the user's data from the database. In addition to the GUI components you have in Assignment One, include the following components.

1. Save Button in the bottom panel, to save the user data to the database.
2. Display All Button in the bottom panel to display the saved data of all users from the database.

The functions of two additional buttons are described below.

1. Save

The Save Button can be used to save the User Energy needs to the data base.

Note: Use the given data file named COIT20256Ass1Data.csv available on the course website and it contains the set of data.

2. Display All

This Button enables the user to view all the database records displaying user details and their energy requirements. The database records will have a unique id. It is not essential to display the id.

The screen with additional buttons are shown below.

6_Initial Screen Display.jpg

Initial Screen Display

1378_Initial Screen Display3.jpg

Screen Display on Clicking "Display All"

Data Structures

DatabaseUtility class: Create this class to implement all the tasks related to creation of database and table, extracting records from the database. Include a linkedList of UserEnergyNeeds class to store the extracted data from the database. Use Prepared statements to get the user input from GUI interface and use them for populating database. Also use prepared statement to execute query to extract data and store the records in a linked list.

Software Tools for Building the Application

You can build your application using the TextPad Editor or NetBeans. It is highly recommended that you create the GUI components using code rather than 'designer' and 'click and drag' of the NetBeans. This creates code which is not maintainable. Remember this is a good prototyping tool, but not recommended for coding.

Part B

Your task in this part of the Assignment is to demonstrate use of various data structures such as stack, priority queue, set, and map using the given data.

While using these data structures to store explain the benefits you can achieve by using the appropriate data structures. You need to complete the following steps in use of various data structures.

1. Read the names from the file and load in a priority queue. Display the values from the priority queue using the peek() method. Describe your observation of change to the list of names in the report file.

2. Move the list of names from the priority queue to stack. Move the list of names from stack while displaying the value to a set. Describe your observation of the stack list of names.

3. Display the names from the set and again describe your observation the list of names.

4. Create a map and store the names with associated student Id and display the values.

Note: Commence with one class at a time, test it and then incrementally add the next.

I am looking for help in my assignments in java programming, could you do my assignments?

Attachment:- dataandsource.zip

Reference no: EM131045060

Questions Cloud

What is the maximum price you should pay for this stock : The Auto Company just paid a dividend of $3.00 and analysts expect the dividend to grow at its compound average growth rate of 10.72% forever. You plan to purchase the stock then hold it for 10 years. Your expected rate of return is 12%, and the next..
Confidence interval to estimate the proportion of fans : Problem: A university would like to estimate the proportion of fans that purchase concessions at the first basketball game of the season. The basketball facility has a capacity of 3,600 and is routinely sold out.
How else could one ensure that the penalty was finite : How else could one ensure that the penalty was finite?
Share at least one personal example in current employment : Share at least one personal example, in current employment or past employment, of a Knowledge Management System that you have used. Share briefly if they were successful or not and why.
Write application that uses interactive gui based on jframe : Write a Java Application that uses an interactive Graphical User Interface (GUI) based on the JFrame class using SWING GUI components
Treasury bills outperformed inflation year during period : Treasury bills outperformed inflation every year during the period 1925-2012. Small-company stocks outperformed large-company stocks every year during the period 1925-2012. On an annual basis, small-company stocks had more consistent rates of return ..
How you would resolve the issue you have outlined : Describe how you would resolve the issue you have outlined (i.e.: what would your judgment be).Explain what ethical standard(s) or principle(s) you are using to come to this conclusion.
How do our personal risk profiles affect us and society : How do our personal risk profiles affect us and society? How does a personal and/or business risk profile benefit or harm society?
The income statement shows net income : Fly Away, Inc., has balance sheet equity of $5.8 million. At the same time, the income statement shows net income of $864,200. The company paid dividends of $466,668 and has 100,000 shares of stock outstanding. If the benchmark PE ratio is 22, what i..

Reviews

Write a Review

JAVA Programming Questions & Answers

  Write an applet file that prompts the user for an id number

Catch the Exception and then display an appropriate message. Save the program as BadIDAndAge.java

  Describe the equivalence classes

Prove that these relations on the set of all functions from Z to Z are equivalence relations. Describe the equivalence classes.

  Allows the user to enter students names followed

Write a program that allows the user to enter students names followed by their test scores and outputs the following information(assume that the maximum nmber of students in the class is 50

  Design a function named "falling distance"

Design a function named "fallingDistance" that accepts an objects falling time, in seconds, as an argument. The function should return the distance, in meters, that the object has fallen during that time interval. Design a program that calls the func..

  Implement the nested loops

The user has also already entered a mystery number they want the following series to calculate based upon their current numbers (also relatively logical in size).

  Sorting routine adopted in the java api for arrays.sort()?

What is the sorting routine adopted in the Java API for Arrays.sort()? How different is it from the sorting routine we discussed in class? Is it better? Explain your answers in short clear sentences.

  Rectangular and cylindrical coordinates

Write a program to convert between rectangular and cylindrical coordinates, based upon user input.

  Public float usefulload()

public float usefulLoad() // this is the grossWeight - emptyWeight public float usefulLoadWithFuel( in gallons ) // this is the useful load - gallons x 6. The programmer user will pass in the number of gallons on board.

  Create listener objects for each jcombobox

Create listener objects for each JComboBox that set the background color of the panel when the user selects an integer. Use the current values supplied by the JComboBox objects to determine the background color.

  Compute the average grades

Write a program that allows a teacher to compute the average grades for EACH student in his or her class (NOT a single average for the entire class)

  What is the value of r

TOY  Consider what happens when the following TOY program is executed by pressing RUN with the program counter set to 10: 10: 8110 R[1] A. What is the value of R[1] after the instruction at location 10 completes? B. What is the value of R[2] after ..

  Project detailsyou will explore basic socket programming

project detailsyou will explore basic socket programming threading and gui design using javas network library threading

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