javafx programming code

Homework Assignment

Without using the Scene Builder, implement an application using JavaFX that stacks the cannon balls.The cannon balls are name-colored.The requirements for this assignment are listed below:

  • The cannon balls are to be painted with one of these colors:
    • AQUA
    • BLACK
    • BLUE
    • CORAL
    • GREEN
    • GREY
    • RED
    • WHITE
    • YELLOW
  • The cannon balls are drawn with the black solid-line strokes with the width specified by the user.
  • The application will have a menu bar on top with two menus, File and Setup.
  • The File menu has the following menu items.
    • Serialize… – When selected, the user is prompted for a file path to serialize the data.Then the pyramid settings and cannon balls settings (as described below) are serialized to disk.
    • Deserialize… – When selected, the user is prompted for the file to deserialize.Then the current pyramid settings and cannon balls settings are replaced with the settings from this file.
    • A menu separator.
    • Save to Database… – When selected, current pyramid settings and cannon balls settings are written to the MySQL database.
    • Load From Database… – When selected, the application will retrieve the list of pyramid names from the MySQL database and present this list to the user.The user will select the pyramid name.Using this pyramid name, the application will replace the current pyramid settings and the cannon balls settings with the settings associated with the selected pyramid name from the MySQL database.
    • A menu separator.
    • Exit – When selected, it will terminate the application.
  • The Setup menu has two menu items:
    • Configure Pyramid… – When selected, this menu item will display the below dialog.The user can specify the name of the pyramid, the height of the pyramid, and the stacking order (LeftJustified, Center, RightJustified) of the cannon balls.The default values are:
      • Name: MyPyramid
      • Height: 5
      • Order: LeftJustified
    • Configure Cannon Balls… – When selected, this menu item will display the below dialog.The user will be able to specify the radius in pixels to draw each cannon ball, the color of the cannon balls, and the stroke width in pixels to draw a back solid-line around each cannon balls.The default values are:
      • Radius:50
      • Stroke Width:1
      • Color:BLUE

  • The settings for the pyramid and cannon balls must be defined separately.In other words, there must be separate classes defined for the pyramid settings and cannon ball settings.
  • The cannon balls are drawn in the drawing panel.They are stacked on each other based on the specified stacking order.
  • The drawing panel is scrollable.The horizontal and vertical scroll bars will appear as needed.
  • There is the status message/bar which displays the pyramid height and the stacking order.
  • Sample screen shots are included below.
  • Here are some helpful sample queries for this assignment:
  • For additional information about Structured Query Language (SQL) syntax and tutorials, refer to the web-site below.

  • The database schema is described below:
    • The database name is:cannon_balls.
    • There are two tables:
      • pyramid_settings – This is the parent table.Its table definition is shown below.
      • cannon_ball_settings – This is the child table.It inherits the values associated with the primary key values of the pyramid_settings table.Its table definition is shown below.

pyramid_settings:

cannon_ball_settings:

// Insert a new record in the pyramid_settings table.

insert into pyramid_settings (pyramid_name, height, stacking_order)

values (‘National University Pyramid’, 1, ‘RightJustified’);

// Insert a new record in the cannon_ball_settings

insert into cannon_ball_settings (pyramid_settings_id, radius, stroke_width, color_name)

values (3, 50, 2, “BROWN”);

// Select all records from the pyramid_settings table.

select * from pyramid_settings;

// Retrieve all pyramid names.

select pyramid_name from pyramid_settings;

// Select all records from the cannon_ball_settings table.

select * from cannon_ball_settings;

// Update the values in the pyramid_settings table where the pyramid name is “peter_pyramid”.

update pyramid_settings

set height = 5, stacking_order = ‘LeftJustified’

where pyramid_name = ‘peter_pyramid’;

// Delete a record from the pyramid_settings table with the pyramid name “peter_pyramid”.

delete from pyramid_settings where pyramid_name = ‘peter_pyramid’;

NOTES: This is an individual programming assignment for the Final Exam. You are encouraged to exchange ideas.However, collaboration, discussion, exchanging code, or any form of plagiarism is allowed. If violated, zero points shall be awarded to all parties involved.