Esempio n. 1
0
 public static void main(String[] args) {
   Scanner s = new Scanner(System.in);
   Store store = new Store();
   System.out.println("Input the name of the first customer. ");
   String n1 = s.next();
   System.out.println("Input the sales price of the first customer. ");
   store.addSale(n1, s.nextDouble());
   System.out.println("Input the name of the second customer. ");
   n1 = s.next();
   System.out.println("Input the sales price of the second customer. ");
   store.addSale(n1, s.nextDouble());
   System.out.println("Input the name of the third customer. ");
   n1 = s.next();
   System.out.println("Input the sales price of the third customer. ");
   store.addSale(n1, s.nextDouble());
   System.out.println("Thanks to " + store.nameOfBest() + " for being our best customer today!");
 }
 public static void main(String[] args) {
   Store bleh = new Store();
   Scanner scan = new Scanner(System.in);
   System.out.println(
       "Enter in the name of a customer,hit enter, then enter in the price of what he bought");
   while (true) {
     String customer = scan.next();
     double price = scan.nextDouble();
     if (price == 0.0 || customer.equals("0")) {
       break;
     }
     bleh.addSale(customer, price);
   }
   System.out.println(bleh.nameOfBestCustomer());
 }