Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

Steps:

Create a Java project in Eclipse, called Lab 2. Next create a java class called Dashboard. It should extend javafx.application.Application. This will be the main GUI for your lab, and it should use a VBox as the root node.

The first element in the VBox should be a button with the text label "Go!".

The second element should be a text field where a user can enter the mean. By default, it should be 0.

The third element should be a text field where a user can enter the standard deviation. By default, it should be 10.

The fourth element should be a text field where a user can enter the number of data elements to randomly generate. Store these numbers that are generated in an ArrayList for later viewing.

In order to generate some data, you will need to use a NormalDistribution object for generating numbers:

NormalDistribution nDist = new NormalDistribution ( µ , s );

use: import org.apache.commons.math3.distribution.NormalDistribution;

With the distribution object, call the sample() function to generate a random number.

When the user clicks the "Go" button, your program should compute the following:

Maximum

Minimum

Mean (Average)

Weighted Average of the first 10 numbers: 10*list[0] + 9*list[1] ... / 55

Median

Standard Deviation (SD)

Figure 1 Prototype of GUI

After calculating the data, open a second Stage window with a layout for displaying the results from step 6. Also, the window should use a ListView for displaying the raw data from the ObservableList that the user can scroll through.

When you are finished, demonstrate your work to the lab professor. Click the "Go" button several times to generate several results sets to show that in small data sets, the Mean, Median and SD can vary. Then generate a large data set (N = 106) to show that larger sample sizes tend to converge to the true values:

With N = 100:

With N = 106:

To create a second stage, use:

Stage newStage = new Stage();

TextField tf = new TextField();

tf.setText(String.format("Mean: %f Max: %f Min:%f SD:%f Median:%f WeightedAverage:%f", mean, max, min, sd, median, weightedAverage));

Scene newScene = new Scene(tf, 500,100);

newStage.setScene(newScene);

.show();

The calculation of standard deviation is:

sd = Math.sqrt( differenceOfSquares( list, mean) / list.size() );// list are your numbers.

Write the differenceOfSquares( List list , double mean) as a function that iterates through every item and calculates the difference between it and the mean, squared:

double sum = 0;

list.forEach( item -> sum += (item - mean)*(item - mean) );

return sum;

To calculate the median, sort the list and get the middle element:

double median = list.get( list.size() / 2);// This is inefficient but works for now

Correctly calculating mean, max, min, median, weighted average, standard deviation: +6

GUI design:

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M93124569

Have any Question?


Related Questions in Computer Engineering

Question suppose that x 00271 and y 608 are correctly

Question : Suppose that x* = 0.0271 and y* = 6.08 are correctly rounded versions of x and y to 3 digit mantissas. The smallest interval [a,b] that would contain x is [0.02705, 0.02715] since 0.0271 is between those numbe ...

Question summarize the process of how cameras and scanners

Question : Summarize the process of how cameras and scanners produce digital images. Compare differences between the production of images on film and digital images.

At a certain temperature 03811 mol of n2 and 1721 mol of h2

At a certain temperature, 0.3811 mol of N2 and 1.721 mol of H2 are placed in a 3.00-L container. N 2 (g)+3H 2 (g) ----->2NH 3 (g) At equilibrium, .1601 mol of N2 is present. Calculate the equilibrium constant, Kc.

After reading the case presented in the module write a

After reading the case presented in the module, write a short response to the following discussion questions and ethical decision making scenario. Discussion Questions What project management tasks should Kelvin perform ...

Start up your web browser and clear the browsers cache

Start up your web browser and clear the browser's cache memory (Use the following website if you don't know how to do this), but do not access any site after clearing the cache. ? Open Wireshark and start capturing. Now, ...

Calculate the price of a five-year bond that has a coupon

Calculate the price of a five-year bond that has a coupon rate of 6.5 percent paid annually. The current market rate is 5.70 percent. (Round answer to 2 decimal places, e.g. 5,275.25.)

1 what is the price of a semiannual 1000 par value bond

1) What is the price of a semiannual $1,000 par value bond with four years left until maturity that pays a coupon of 3.75% and is yielding 5.25%? What would it be yielding if the price decreased to $973.47? Assume semian ...

Consider the following half-reactionsoxidation

Consider the following half-reactions: Oxidation: 2I - (aq)  --> I 2(aq)  +2e - Reduction: MnO 4 - (aq)  +8H + (aq)  + 5e -  -->Mn 2+ (aq)  + 4H 2 O (l) a) Write the overall reaction. b) A galvanic cell based on this rea ...

Regarding terminology for the quality of a picture explain

Regarding terminology for the quality of a picture, explain briefly What is a pixel? What is color depth? Higher is better or lower Search for purchasing a monitor, list the specifications (concentrate on the criteria th ...

Research report assignment -background - you are working

RESEARCH REPORT ASSIGNMENT - BACKGROUND - You are working for a software development company in Brisbane which is considering establishing several teams which may be located in countries as diverse as China, Brazil, and ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As