Programming Assignment 06

Deadline: October 30, 2024 – Wednesday, 11:30pm

Garden GUI out – simple mode

Learning Objectives

The goal of this assignment is to use basic JavaFX to create a GUI output representation of the Garden program.

The Assignment

In this assignment, you will build on your Garden implementation to visually represent your garden simulation. You will be representing each plant in the output as well as handling a ‘delay’ command from the input file that represents how long to wait between the execution of commands. Each character from the garden run output is rendered on the GUI as a shape.

You will be creating a variant of Garden.in for your own unique plant or garden object.

Here’s a video demonstration of what you need to implement. You don’t have to implement your garden GUI exactly like mine – you can be as creative as you want here. As long as your commands make sense on your GUI (you need to record both your App.java with a header with your name, and the window should have your name on it).

Delay parameter

The input file format for this assignment is exactly the same as that of PA5 Garden, except that you will now have to handle a delay parameter. The delay will be specified on the third line of the input file right under the ‘cols’ parameter. An example input is shown below:

rows: 1
cols: 1
delay: 3.0

PLANT (0,0) sunflower
PLANT (2,2) tulip
PLANT (5,5) iris
GROW 1

The number after ‘delay:’ is a double that represents the time to wait before each command is executed. In the example provided, this delay was set to .5, therefore, each command was executed after waiting a half second.

Steps for completing this assignment

  1. We will be using JavaFX for our GUI in this course. I recommend you use JavaFX on VS Code, create a non-modular project with Maven: Getting Started with JavaFX
  2. Create your own copy of Garden.in called myGarden.in that includes planting your unique garden item.
  3. Make a video of running myGarden.in through your program.

Grading Criteria

80% of this assignment grade will correctness. For this assignment, this is the GUI output. The autograder will not be running automated tests for this assignment.

Your code should run in any computer (TAs will run your code). You should also expect that we will run your program with additional input files besides the ones provided. Your package information should match what you have for your project on the IDE – meaning, whatever runs in your computer, since you are required to submit all your files.

The other 20% of your grade will be your decomposition and code clarity.

Decomposition

  • Points will be taken off for copy, pasted, and edited code that should have been encapsulated in a method.

  • This program should use fewer than 10 .java files. Each of these files should be (<300 lines).

  • Each method should be less than 30 lines. This INCLUDES comments, but not the method header. It is easier to read a function if it can all fit on one screen.

Code Clarity * YOU should be able to read, understand, and explain your own code to someone else a couple days after you wrote it. * No magic numbers * No methods written to just get the test cases to work

  • There needs to be a balance between no comments in the body of the methods and a comment for every line in the program. Either extreme will result in points off.

  • The file header should include instructions on how someone would use this program. To use the program, one would need to know the input file format. One would also need to know the command line arguments that should be passed to the program.

  • Use meaningful variable names. Loop iterators can be simple (i for integers, s for strings, n for numbers, etc.).

  • The clearest code examples will be anonymously shown in class.

  • The most obfuscated code examples will be anonymously shown in class with suggestions for improvement.

Submission

For this assignment, you are REQUIRED to submit all of the following files to Gradescope:

  • All the Java source files needed to run your program.
  • myGarden.in
  • myGarden.mp4, or other video format that can be run on multiple platforms. The video should be between 10 and 15 seconds long.

When recording the video, you are required to have your name on the title of the GUI window, and you are required to show your source code (App.java) with the header showing the current semester and your name. Here’s an example:

To create the video, you can use a program to record your screen as you run your program, or you can simply record your screen with your smartphone or tablet. Do note however that the video you submit must be of good enough quality for the TAs to clearly see your garden and command logs and your name on your App.java file and your window title.

Write your own code. We will be using a tool that finds similar code.

It is recommended that when talking with others about the assignment, do not write anything down.