import javax.swing.*;
/**
 * BreatherTester tests Breather methods
 */
public class BreatherTester {
  
  public static void test() {
    Breather breather1, breather2;
    Chamber chamber1, chamber2;
    AirFillShop afs1, afs2;

    // Prompt user for first air fill shop's information, and create it
    String afsName=
      JOptionPane.showInputDialog("First air fill shop's name?");
    double afsPrice=
      Double.parseDouble(JOptionPane.showInputDialog("First air fill shop's price? (double)"));
    afs1= new AirFillShop(afsPrice, afsName);
  
    // Prompt user for second air fill shop's information, and create it
    afsName= JOptionPane.showInputDialog("Second air fill shop's name?");
    afsPrice= 
      Double.parseDouble(JOptionPane.showInputDialog("Second air fill shop's price? (double)"));
    afs2= new AirFillShop(afsPrice, afsName);
    
    // Prompt user for first chamber's information, and create it
    String cAddress=
      JOptionPane.showInputDialog("First chamber's address?");
    chamber1= new Chamber(cAddress, afs1);
    
    // Prompt user for second chamber's information, and create it
    cAddress=
      JOptionPane.showInputDialog("Second chamber's address?");
    chamber2= new Chamber(cAddress, afs2);
    
    // Prompt user for first breather's information
    String bName=
      JOptionPane.showInputDialog("First breather's name?");
    int bCap=
      Integer.parseInt(JOptionPane.showInputDialog("First breather's capacity? (int)"));
    double bMoney=
      Double.parseDouble(JOptionPane.showInputDialog("First breather's money? (double)"));
    
    // Create first breather four different ways, and check with toString()
    System.out.println("Creating breather using first constructor");
    breather1= new Breather(bName, bCap);
    System.out.println("breather1: " + breather1.toString());
    System.out.println("\nCreating breather using second constructor");
    breather1= new Breather(bName, bCap, bMoney);
    System.out.println("breather1: " + breather1.toString());
    System.out.println("\nCreating breather using third constructor");
    breather1= new Breather(bName + ", " + bCap + ", " + bMoney);
    System.out.println("breather1: " + breather1.toString());
    System.out.println("\nCreating breather using fourth constructor");
    breather1= new Breather(bName, bCap, bMoney, chamber1);
    System.out.println("breather1: " + breather1.toString());
    
    // Prompt user for second breather's information
    bName=
      JOptionPane.showInputDialog("Second breather's name?");
    bCap=
      Integer.parseInt(JOptionPane.showInputDialog("Second breather's capacity? (int)"));
    bMoney=
      Double.parseDouble(JOptionPane.showInputDialog("Second breather's money? (double)"));
    
    // Create second breather, check with toString()
    System.out.println("\nCreating second breather");
    breather2= new Breather(bName, bCap, bMoney, chamber2);
    System.out.println("breather2: " + breather2.toString());
    
    // the first breather buys air, then breathes
    System.out.println("\nFirst breather buys air");
    breather1.buyAir();
    System.out.println("breather1: " + breather1);
    System.out.println("First breather breathes");
    breather1.breathe();
    System.out.println("breather1: " + breather1);
    
    // the second breather buys air, then checks whether it can breathe
    System.out.println("\nSecond breather buys air, then checks whether it can breathe");
    breather2.buyAir();
    System.out.println("breather2 can breathe: " + breather2.canBreathe());
    
    
    // the first breather earns some money, moves to the second chamber
    // second breather breathes
    System.out.println("\nFirst breather earns 1000 and moves to second chamber");
    breather1.earnMoney(1000);
    System.out.println("breather1: " + breather1);
    breather1.move(chamber2);
    System.out.println("breather1: " + breather1);
    System.out.println("\nSecond breather breathes");
    breather2.breathe();
    System.out.println("breather2: " + breather2);
    System.out.println("breather1: " + breather1);
    //
  } 
  
}