Familiarize yourself with the given code

Assignment Help Database Management System
Reference no: EM131596171

Lab Assignment- GUI, Data Manager and Data Elements

Concepts tested by this program:

Inheritance
Interfaces
Polymorphism
Abstract classes
Overriding methods
Graphing with JavaFX

NOTE: This lab requires attention to detail. Follow the following instructions carefully.

When computing limits, it is sometimes not obvious whether a limit exists simply by studying the function. Graphing the function and viewing it may sometimes help. In this lab, you will use and extend an application that graphs several functions. Refer to the Task #0 through Task #3 below for specific instructions.

Operation

· When the user selects the "Graph a Function" button, the application will display a list of functions and ask the user to select one of them to plot.

· The application will then ask the user for the left and right extents (i.e., between what values of x will the function be plotted), from which it will calculate the maximum and minimum values of the function that will be displayed.

· Then the application will transform the function to the coordinate system of the display and plot it.

· The user may then re-graph the same or a different function, or exit.

Specifications

Data Element - the data elements are each value of x, from left extent to right extent, by increments of one pixel, and the corresponding values of f(x). The x and f(x) transformed into the display coordinate system are an additional data element.

Data Structure - The abstract class Function holds an abstract method fnValue that is specific to each sub-class function, and an implemented function fnValueToPlot that uses fnValue to transform the values to the display coordinate system.

The following three functions have been implemented, each in a class that extends Function:

Each function has a toString() method that returns a description of the function, preceded by its index.

Data Manager - the GraphManager class implements the methods of GraphManagerInterface. The GraphManager does not use any GUI methods.

The GraphManager selects the correct instance of the function based on the integer chosen. It implements its toString method by calling the function toString methods. It receives the user-selected extents of x (left and right) and the grid width in pixels and computes the extents of f(x) (minimum and maximum). To do this it computes values of f(x) over the extents of x from the left to the right extent in increments of one pixel (i goes from 1 to gridWidth) in order to determine the maximum and minimum extent of f(x).

Then the GraphManager uses the selected function instance and calls the function's method fnValueToPlot inherited from the Function class to compute the value of the function within the coordinate system of the panel. This value is returned to the GUI to be plotted.

GUI Driver

· At start-up, a blank panel displays with an Exit Button and a Graph Function button.

· The GUI creates and uses a GraphManager object.

· A JOptionPane is presented to prompt the user to choose one of the functions. The GraphManager's toString method is used to display the possible functions. If the user enters a non-integer, the exception will be caught and displayed, and will prompt for another entry. If the user enters an integer outside the range of 1 to 5, the user will be prompted for another entry until the user enters a valid integer. Once the user enters a valid integer, the GUI calls the GraphManager's setFunctionChoice method.

· A JOptionPane is used to select the left and right extents of x (i.e., the minimum and maximum values of x). Exceptions will be thrown and caught if the user enters a non-number, error messages will be printed if an exception is thrown, and the user will be prompted for another entry until a valid number is entered. Once the user enters a valid number, the GUI calls the GraphManager's setExtents method to store the left and right extents and computes the maximum and minimum extents of the chosen function.

· When the user selects the "Graph a Function" button and enters valid choices, the GUI calls the drawGraph() method. The Pane that holds the graphs is a Canvas class. It's method getGraphicsContext2D() is used to get an object with which to draw on the Canvas. For a GraphicsContext instance called gc, use the following method to draw a line segment between the two points (x1,y1) and (x0,y0).
gc.strokeLine(x0, y0, x1, y1);

The draw method iterates through each pixel from i=0 to i=gridWidth, and using the function instance retrieved from the GraphManager, calls the method fnValueToPlot inherited from the Function class to display the function within the coordinate system of the panel. It uses the above draw method to plot a line segment from x0=i to x1= i+1.

· The user will be allowed to repeat the process for the same or another function.

TASK #0 - Study the UML Class Diagram and the code.

Familiarize yourself with the code. Follow it from the class GraphDriverFX and its method "start()", to MainPaneFX, to GraphPanelFX and GraphManager. Run it and observe its behavior. It will be incomplete when you first run it.

TASK #1 - Implement the Line-drawing

When you first run the application, the graph will not be plotted, although the prompts will appear and be handled. In the method drawGraph(double, double, GraphicsContext), add a call to gc.strokeLine(x0Draw, y1Draw, x1Draw, y0Draw) to plot each line segment of the graph.

Experiment with all three functions provided, varying left and right extents. Notice the gray horizontal line that is plotted at y=0 for reference.

TASK #2 - Add another function

Note that function #3 is a complicated, fairly unpredictable function. Run it with several extents, and note the singularities, where the graph goes to "infinity". Then notice that the denominator of function #3 is just a cubic polynomial.

Implement the denominator of function #3 as function #4. Run function #4 to estimate where the function goes to zero, which will of course make function #3 undefined. Include in your writeup an estimate of the point or points at which function #4 goes to zero.

TASK #3 - Add a fifth function

Very interesting behavior happens with the function f(x)=sin(1/x). Implement it, and run it with various extents. Include in your writeup what you think is happening with the function. At what value of x does the limit not exist?

Turn in the following:

The corrected java src directory in a compressed (zip or tar) file

A document with comments from Task #2 and #3.

Reference no: EM131596171

Questions Cloud

Organ transplant that you have chosen to research : An introduction that identifies the topic of organ trasplant as you will discuss it and sets up the ethical question you intend to answer.
Discuss about the external forces in garnering support case : Choose one of the prominent Middle Eastern terrorist groups discussed this week. In a two-page paper discuss what techniques the organization you choose.
Attitude and emotions from nonverbal : Studies indicate that people read much more about another's attitude and emotions from their nonverbal cues than their words.
What was the maximum ira contribution that ellen could have : What was the maximum IRA contribution that Ellen could have made for 2016, which she could have deducted on her 2016 individual tax return
Familiarize yourself with the given code : Familiarize yourself with the code. Follow it from the class GraphDriverFX and its method "start()", to MainPaneFX, to GraphPanelFX and GraphManager.
Create more value by attempting to roic while lower : High-ROIC companies typically create more value by attempting to the ROIC while lower-ROIC companies create more value by growing the corporation.
Wrongful termination based on policy violations : Discuss the issue of wrongful termination based on policy violations, especially if policy was not being followed by more than a single employee.
Analyze the role that culture plays in global business ethic : Describe the importance and rationale for maintaining an ethical culture within the entire organization.
Find f(g(3)) and g(f(3)) and g(f(x)) : If f(x) = 2 - 6x + x2 and g(x) = x/x - 7 + 1.5 find f(g(3)) and g(f(3)) and g(f(x)) before evaluating for 3. Round the answers to the nearest two decimal places.

Reviews

Write a Review

Database Management System Questions & Answers

  Knowledge and data warehousing

Design a dimensional model for analysing Purchases for Adventure Works Cycles and implement it as cubes using SQL Server Analysis Services. The AdventureWorks OLTP sample database is the data source for you BI analysis.

  Design a database schema

Design a Database schema

  Entity-relationship diagram

Create an entity-relationship diagram and design accompanying table layout using sound relational modeling practices and concepts.

  Implement a database of courses and students for a school

Implement a database of courses and students for a school.

  Prepare the e-r diagram for the movie database

Energy in the home, personal energy use and home energy efficiency and Efficient use of ‘waste' heat and renewable heat sources

  Design relation schemas for the entire database

Design relation schemas for the entire database.

  Prepare the relational schema for database

Prepare the relational schema for database

  Data modeling and normalization

Data Modeling and Normalization

  Use cases perform a requirements analysis for the case study

Use Cases Perform a requirements analysis for the Case Study

  Knowledge and data warehousing

Knowledge and Data Warehousing

  Stack and queue data structure

Identify and explain the differences between a stack and a queue data structure

  Practice on topic of normalization

Practice on topic of Normalization

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