Answer: Move on to testing other methods than the constructors. You only need (at most) two breathers to test the remaining methods.
Paradise Chambers in the chamber
example?
Answer: This is the address of a chamber. Some addresses are so famous that they don't require street numbers (e.g. Eaton Centre, City Hall).
prompt the user for information for two breathers, two chambers, and information for two air fill shops.How can it prompt for an air fill shop or a chamber, aren't these objects (and showInputDialog returns a String)?
Answer: That's information for breathers, chambers, and shops. The information will be provided by the user as one or more Strings. You will also find it more feasible to get the information for the air fill shops first, then the chambers, then the breathers, since this is the order things are most easily built.
Breather, and we're only
supposed to create 6 objects, including two chambers and two
air fill shops.
Answer: You create a minimum of 6
objects. You should test four constructors, since
constructors are methods and you are asked to test every
method. You could use each of the four constructors, store
the Breather reference in a variable, test that
the constructor worked, and move on.
Answer: No. Here's a more realistic example of what the
toString() method for Last Gasp might return:
Last Gasp: 76.92307692307692 millilitres per dollar.I've modified the A2 handout appropriately.
AirFillShop has a price per litre of air
which is never less than $1.00. How can I check that this is
so without using an if statement?
Answer: You don't need to check this, just assume that it's so. As a consequence, you don't need to worry about dividing by zero.
AirFillShop:" can I choose to implement the
method I find easiest?
Answer: No, you must provide the
user of your code with the choice! In other
words, you implement two different constructors for
AirFillShop, two for Chamber, and
four for Breather
Chamber: address, Air (in litres): xxx, Air fill shop: name.
Answer: Yes. There was a clerical error in the handout, which has now been fixed.