# ECE 538 Assignment 5

1. Write a Java application that draws a resistor on the screen and uses three buttons to move the resistor up or down and rotate the resistor by 45-degrees. Use your most recent Resistor class.

2. Write a Java program to read a resistor net description from a file. Each line of the file should describe one resistor (space-delimited tokens) in the form `R name node1 node2 value x y angle`. where name is a string, node1 and node2 are integers, and the remaining variables are doubles. Your program should run even if some parameters (such as `x y angle`) are missing.

Store the resistor data in an `ArrayList` and print the data to a `TextArea`. Demonstrate using the netlist file circuit1.txt.

You should read the netlist from a file specified by `JFileChooser` (which should open in the current directory).

3. Modify the previous program so that it uses `Jama` to construct and solve the nodal analysis matrix equation A v = b for the nodal voltages v. Print the matrices and solution vector to a `TextArea`. Demonstrate using the netlist file circuit1.txt. Assume a current source of 1 mA flowing into node 1 from node 0 (ground) as shown in the circuit drawing below. See sample.java for hints on setting up the solution.

4. Modify the bouncing ball program to simulate Newton's cradle. Line up five balls in a horizontal row with the first ball moving to strike the others as shown below

5. Using `GraphicsImage.java`, as a model, write a program to convert the drawing you did in problem 4 of Assignment 4 into an image of type `.png`.

6. Modify an image display program (such as LoadImageApp) to add a JLabel in BORDER.SOUTH that displays the location of the mouse and the color of the pixel at that location. Use a `JFileChooser` dialog to allow the user to select an image file.

7. Report on progress you are making with your group project. Your new implementation should involve interaction with the mouse, e.g. dragging objects around the screen and/or using mouse clicks to trigger some action.

Maintained by John Loomis, last updated 20 February 2019