/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package cs1336sample2;
import java.util.*;
import javax.swing.JOptionPane;
import java.text.DecimalFormat;
import java.math.*;

/**
 *
 * @author jxc064000
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args)
        {
      int days;            // The number of days
      double sales;        // A day's sales figure
      double totalSales;   // Accumulator
      String input;        // To hold the user's input

      // Create a DecimalFormat object to format output.
      DecimalFormat dollar = new DecimalFormat("$#,##0.00");
     DecimalFormat fmt = new DecimalFormat("00");

      // Simulate the clock.
      for (int hours = 1; hours <= 12; hours++)
      {
          for (int minutes = 0; minutes <= 59; minutes++)
          {
             for (int seconds = 0; seconds <= 59; seconds++)
             {
                System.out.print(fmt.format(hours) + ":");
                System.out.print(fmt.format(minutes) + ":");
                System.out.println(fmt.format(seconds));
              }
          }
       }
      // Get the number of days.
/*      input = JOptionPane.showInputDialog("For how many days " +
                                   "do you have sales figures?");
      days = Integer.parseInt(input);*/

      // Set the accumulator to 0.
      totalSales = 0.0;
int count = 1;
      // Get the sales figures and calculate a running total.
      while (true)
      {
         input = JOptionPane.showInputDialog("Enter the sales " +
                                       "for day " + count + ": ");
         if (input.equals("*"))
            break;
                //???sales = Double.parseDouble(input);
         totalSales += Double.parseDouble(input);   // Add sales to totalSales.
         count++;
      }
      // Display the total sales.
      JOptionPane.showMessageDialog(null, "The total sales are " +
                                    dollar.format(totalSales));
      
      for (int i=1; i<=9; i+=3)
      {
          for (int j=1; j<=9; j+=3)
          {
              System.out.printf("%3d",i * j);
          }
          System.out.println();
                  
      }



      System.exit(0);
    }


}

