ECE 538 Assignment 4

Your submission should follow our general guidelines. Please follow object-oriented principles. Include executable jar files for all programs.

  1. Write a program to read a list of resistors from a file and calculate the parallel resistance. Use your Resistor class and an ArrayList to store the resistors. Use a FileChooser to select the input file. Use the String.split function to parse the input lines. See Parsing strings with split Demonstrate using example.txt
  2. Extend your resistor class to include location variables and a draw function. Extend the previous program to read location variables (in addition to resistor name and value) from a file. For example: R1 500 50 100 where (50, 100) is the location on the screen. Your new program should draw the resistors. Demonstrate with at least four resistors.
  3. Write a program to calculate the greatest common divisor of two integers. This is used to reduce fractions such as 14/42 to standard form (i.e., 1/3). You can use Euclid's algorithm from rational.java. Put a debug print statement in the while loop to show intermediate values in the process.
  4. Write a program that includes a Rotate button. When pressed, the object (e.g. resistor) displayed at the cener of the screen should rotate 30 degrees counter-clockwise. You should be able to use your resistor object from problem 2.
  5. Modify writeToFileZipFileContents from the previous assignment to use a TextArea as the destination instead of a file.
  6. Write a JavaFX program to demonstrate your knowledge of the Java graphics operations by creating a unique and interesting drawing. Use as many Shape features as you can – strokes, filled shapes, polygons, arcs, rectangles, etc.


Maintained by John Loomis, last updated 25 May 2015