예제 #1
0
 public void configureCar(Automotive car) {
   System.out.println("Configure the Car-\nPlease enter option choice.");
   Scanner read = new Scanner(System.in);
   ListIterator<String> it = car.getOptionSetNamesIterator();
   while (it.hasNext()) {
     String optionSetName = it.next().toString();
     System.out.println(optionSetName + ":");
     try {
       car.setOptionChoice(optionSetName, read.nextLine());
     } catch (InvalidOptionException e) {
       e.fixException();
     }
   }
   car.calculateFinalPrice();
   System.out.println("\nFinal Configuration-");
   car.printFinalConfig();
 }
예제 #2
0
 public String readFromConsole(String question) {
   System.out.println(question);
   Scanner read = new Scanner(System.in);
   return read.nextLine();
 }