02-Week.docx

advertisement
Week 02 assignment
We will start with the WinIO.java example we used in class on Wednesday.
Your goal is to modify it to replicate these:
Notes:
1.
2.
3.
4.
5.
6.
7.
8.
Your name should appear in the title bar of the window, as above
The first button should calculate the average of the three numbers and display it as shown.
The second button should calculate the distance from (0,0,0) to (A,B,C)
The third button should calculate the two roots of Ax2 + Bx + C = 0 (You may ignore details like
A=0 or having a negative discriminant. Just let the program crash for these odd cases.
Make sure the three buttons are properly labeled.
Make sure all three buttons work with all ‘reasonable’ input, not just the example numbers
shown above.
You may start with a cleaned-up version of WinIO.java that I uploaded to the class website
today.
Extra credit opportunity: check to make sure that the discriminant is positive and that A0, and
warn the user rather than crash.
The .java file should be uploaded into the Angel dropbox for it.
Download