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,

COMP10062: Assignment 1
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 (don't 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 (e.g.0 to 2000, 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 x
value for each point or bar, and you'll have to compute the Y 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 100 and the maximum is 300, then the range is 200. If the user
enters 150, convert it to a decimal like this: 150-100200=0.25. Then if you know your graph is 500 px
high, multiply by 500 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 (i.e. "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 (i.e. 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 (40%), structure (40%) and
documentation (20%) using the rubric on
the MyCanvas Assignment.
Extra challenge 2: Add images to your display to dress it
up some more.
Image img = new Image ("imagename.jpg");
gc.drawImage (img,x,y)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!