July 1

July 2

 

  • Introducing BlueJ
    • Download BlueJ
    • Install
    • Create new Project; notice that project name attaches to FOLDER
    • Experiment with default class
    • Wrap in “Main” class
    • Run from command line
    • Zip and email

11:45 Lunch


 

Email a zip file to mjspieglan@gmail.com

  • Do BlueJ Interactive Tutorial
    • Create and run “Hello World”
    • Tutorial: Cat and Test Class
    • Tutorial: Java FX

Homework

Write a Calculator class. It will only need one property:

  • private double display;

The constructor should initialize the value of the display to 0.0.

It should have the following methods:

  • double show()  — returns the value of the display
  • void clear() — resets the display to zero.
  • double add(double num) — adds the value of “num” to “display” and returns the result.

In similar fashion, add methods to subtract, multiply, divide, and maybe other things you can think of.

All of these are to be used “by hand” from the Object Bench.

Try to write at least one test for the Calculator.