SHOW:
|
|
- or go back to the newest paste.
| 1 | - | import java.util.*; |
| 1 | + | public class Customer |
| 2 | - | public class CustomerTest |
| 2 | + | |
| 3 | private String name; | |
| 4 | - | public static void main(String[] args) |
| 4 | + | private double sales; |
| 5 | - | {
|
| 5 | + | public Customer() |
| 6 | - | double totalSales = 0; |
| 6 | + | {
|
| 7 | - | ArrayList<String> customerList; |
| 7 | + | |
| 8 | - | customerList = new ArrayList<String>(); |
| 8 | + | } |
| 9 | - | ArrayList<Double> salesList; |
| 9 | + | public String getName() |
| 10 | - | salesList = new ArrayList<Double>(); |
| 10 | + | {
|
| 11 | - | Scanner myScanner = new Scanner(System.in); |
| 11 | + | return name; |
| 12 | - | boolean done = true; |
| 12 | + | } |
| 13 | - | do |
| 13 | + | public double getSales() |
| 14 | - | {
|
| 14 | + | {
|
| 15 | - | Customer aCustomer = new Customer(); |
| 15 | + | return sales; |
| 16 | - | System.out.println("1) Add a new customer \n 2) Print all customers \n 3) Compute and print the total sales \n 4) Quit");
|
| 16 | + | } |
| 17 | - | int choice = Integer.parseInt(myScanner.nextLine()); |
| 17 | + | public void setName(String inName) |
| 18 | - | if (choice == 1) |
| 18 | + | {
|
| 19 | - | {
|
| 19 | + | this.name = inName; |
| 20 | - | System.out.print("Add a new customer ");
|
| 20 | + | } |
| 21 | - | String answer = myScanner.nextLine(); |
| 21 | + | public void setSales(double inSales) |
| 22 | - | aCustomer.setName(answer); |
| 22 | + | {
|
| 23 | - | System.out.print("Enter their sales ");
|
| 23 | + | this.sales = inSales; |
| 24 | - | String answer2 = myScanner.nextLine(); |
| 24 | + | } |
| 25 | - | double answer3 = Double.parseDouble(answer2); |
| 25 | + |