package com.samovich.cop2800.chapter3;

import java.util.Scanner;

/**
 * Filename CreateSpaServices.java
 * Created by Valery Samovich
 * Written on 5/23/2016
 */
public class CreateSpaServices {

    public static void main(String[] args) {

        // declare variables
        String service;
        double price;

        // declare objects
        SpaService firstService = new SpaService();
        SpaService secondService = new SpaService();
        SpaService thirdService = new SpaService();
        Scanner keyboard = new Scanner(System.in);

        // prompt the user for first service
        System.out.print("Enter service >> ");
        service = keyboard.nextLine();
        System.out.print("Enter price >> ");
        price = keyboard.nextDouble();

        // recall the set methods
        firstService.setServiceDescription(service);
        firstService.setPrice(price);

        // remove the enter key thar remains in buffer
        keyboard.nextLine();

        // prompt the user for second service
        System.out.print("Enter service >> ");
        service = keyboard.nextLine();
        System.out.print("Enter price >> ");
        price = keyboard.nextDouble();

        // recall the set methods
        secondService.setServiceDescription(service);
        secondService.setPrice(price);

        // display the details for first service
        System.out.println("First service details:");
        System.out.println(firstService.getServiceDescription() + " $" +
                firstService.getPrice());
        System.out.println("Second service details:");
        System.out.println(secondService.getServiceDescription() + " $" +
                secondService.getPrice());
        System.out.println("Third service details:");
        System.out.println(thirdService.getServiceDescription() + " $" +
                thirdService.getPrice());
    }
}

@@ -241,84 +241,8 @@
  %7B%0A%0A
-        // declare variables%0A        String service;%0A        double price;%0A%0A
     
@@ -421,24 +421,25 @@
 vice();%0A
+%0A
         
 Scanner 
@@ -434,310 +434,225 @@
     
-Scanner keyboard = new Scanner(System.in);%0A%0A        // prompt the user for first service%0A        System.out.print(%22Enter service %3E%3E %22);%0A        service = keyboard.nextLine();%0A        System.out.print(%22Enter price %3E%3E %22);%0A        price = keyboard.nextDouble();%0A%0A        // recall the set methods%0A        
+firstService = getData(firstService);%0A        secondService = getData(secondService);%0A%0A        // display the details for first service%0A        System.out.println(%22First service details:%22);%0A        System.out.println(
 firs
@@ -652,33 +652,33 @@
 ln(firstService.
-s
+g
 etServiceDescrip
@@ -678,34 +678,43 @@
 Description(
-service);%0A
+) + %22 $%22 +%0A        
         firs
@@ -718,33 +718,33 @@
 irstService.
-s
+g
 etPrice(
 price);%0A%0A   
@@ -735,361 +735,94 @@
 ice(
-price);%0A%0A        // remove the enter key thar remains in buffer%0A        keyboard.nextLine();%0A%0A        // prompt the user for second service%0A        System.out.print(%22Enter service %3E%3E %22);%0A        service = keyboard.nextLine();%0A        System.out.print(%22Enter price %3E%3E %22);%0A        price = keyboard.nextDouble();%0A%0A        // recall the set methods%0A        
+));%0A        System.out.println(%22Second service details:%22);%0A        System.out.println(
 seco
@@ -831,17 +831,17 @@
 Service.
-s
+g
 etServic
@@ -857,26 +857,34 @@
 ion(
-service);%0A
+) + %22 $%22 +%0A       
         
 seco
@@ -871,32 +871,33 @@
 %0A               
+ 
 secondService.se
@@ -898,17 +898,17 @@
 ice.
-s
+g
 etPrice(
 pric
@@ -907,65 +907,11 @@
 ice(
-price);%0A%0A        // display the details for first service
+));
 %0A   
@@ -927,37 +927,37 @@
 em.out.println(%22
-First
+Third
  service details
@@ -980,37 +980,37 @@
 tem.out.println(
-first
+third
 Service.getServi
@@ -1042,37 +1042,37 @@
                 
-first
+third
 Service.getPrice
@@ -1084,176 +1084,218 @@
     
+%7D%0A%0A
     
-System.out.println(%22Second service details:%22);%0A        System.out.println(secondService.getServiceDescription() + %22 $%22 +%0A                secondService.getPrice()
+public static SpaService getData(SpaService s)%7B%0A%0A        // declare variables%0A        String service;%0A        double price;%0A%0A        // declare object%0A        Scanner keyboard = new Scanner(System.in
 );%0A
+%0A
     
@@ -1318,151 +1318,269 @@
 rint
-ln(%22Third service details:%22);%0A        System.out.println(thirdService.getServiceDescription() + %22 $%22 +%0A                thirdService.getPrice())
+(%22Enter service %3E%3E %22);%0A        service = keyboard.nextLine();%0A        System.out.print(%22Enter price %3E%3E %22);%0A        price = keyboard.nextDouble();%0A        keyboard.nextLine();%0A%0A        s.setServiceDescription(service);%0A        s.setPrice(price);%0A        return s
 ;%0A  

Add data entry method