Question: COMP 1 0 0 6 2 : Assignment 1 O Sam Scott, Mohawk College The Assignment: Bar or Line Graph This assignment is about variables,
COMP: Assignment
O Sam Scott, Mohawk College
The Assignment: Bar or Line Graph
This assignment is about variables, data types, arithmetic expressions, and flow of control. You will use
the FXGraphicsTemplate for this assignment or the FXAnimationTemplate if you decide to use
animations
Here are some example graphs. They were created in Excel, not by a Java program.
Instructions
Use the FXGraphicsTemplate for this assignment. Change the class name to something meaningful and
change the window title, and size of the stage to whatever you want.
When your app runs, the first thing you should do is have a dialog with the user using
System.in and
System.out dont show the JavaFX stage until after this dialog is over The app should ask the user to
enter the following information for a graph:
Graph Title
Range of values eg to as in the graphs above for the vertical axis
A series of labels for the horizontal axis and the corresponding value for each label to be
graphed. You may choose to implement a line graph using points connected by lines or a bar
graph using vertical bars
Make sure the user cannot enter any values outside of the range they specified. If they do try to enter a
value outside of the range, prompt the user to try again.
The vertical axis should have labels for the minimum and maximum values as provided by the user, as
well as at least one point between those values, positioned appropriately.
As the user is entering labels and legal values, you should be drawing either a bar for each value, or a
point that is connected by a line to the last point entered. You will have to keep track of the current
value for each point or bar, and you'll have to compute the value for the point or top of the bar by
scaling the value the user enters based on the range they specified.
For example, if the minimum value is and the maximum is then the range is If the user
enters convert it to a decimal like this: Then if you know your graph is px
high, multiply by to figure out how far up the graph the point or bar should go
You should display your own programming credits on the screen as well ie "program by Josephine
Smith" or something like that
Finally, show the stage.
Documentation Standards
Don't forget to follow the Documentation Standards for the course ie Javadoc commenting,
meaningful variable and class names, consistent indenting See Documentation Standards on Canvas.
Handing In
Please see MyCanvas for instructions on when the assignment is due and the format required to hand
the assignment in
Evaluation
Your assignment will be evaluated for
performance structure and
documentation using the rubric on
the MyCanvas Assignment.
Extra challenge : Add images to your display to dress it
up some more.
Image img new Image imagenamejpg;
gcdrawImage img
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
