import javax.swing.*;
/**
 * ChamberTester tests some Chambers
 */
public class ChamberTester {
  
  /**
   * Create some Chambers and then test their methods.
   */
  public static void test() {
    // Try out the first constructor
    String address= JOptionPane.showInputDialog("Chamber address? ");
    String afsName= JOptionPane.showInputDialog("AFS name?");
    String afsPrice= JOptionPane.showInputDialog("AFS price?");
    double d= Double.parseDouble(afsPrice);
    Chamber c1= new Chamber(address, new AirFillShop(d, afsName));
    
    // Try out the second constructor, plus setNearestAirFillShop()
    address= JOptionPane.showInputDialog("Chamber address?");
    afsName= JOptionPane.showInputDialog("AFS name?");
    afsPrice= JOptionPane.showInputDialog("AFS price?");
    d= Double.parseDouble(afsPrice);
    AirFillShop afs= new AirFillShop(d, afsName);
    Chamber c2= new Chamber(address);
    c2.setNearestAirFillShop(afs);
    
    // Try out toString()
    System.out.println("c1: " + c1.toString());
    System.out.println("c2: " + c2.toString());
    
    // Check out getAddress()
    System.out.println("c1's address: " + c1.getAddress());
    System.out.println("c2's address: " + c2.getAddress());
    
    // Check out adjustAirBy() and getAvailableAir()
    c1.adjustAirBy(97);
    c2.adjustAirBy(853);
    System.out.println("c1 now: " + c1);
    System.out.println("c2 now: " + c2);
    c2.adjustAirBy(-760);
    c1.adjustAirBy(-53);
    System.out.println("c1 now: " + c1);
    System.out.println("c1 has: " + c1.getAvailableAir() +
                       " litres.");
    System.out.println("c2 now: " + c2);
    System.out.println("c2 has: " + c2.getAvailableAir() +
                       " litres.");
    
    // Check out getNearestAirFillShop
    System.out.println("c1 uses: " + c1.getNearestAirFillShop());
    System.out.println("c2 uses: " + c2.getNearestAirFillShop());
  }
}