I'm trying to do some consolidation but I'm not sure on the specific rules of consolidation so I'm having A LOT of difficulty on it. Here's what I'm trying to do.
Write a program that prompts for and reads in three names and creates an account with an initial balance of $100 for each. Print the three accounts, then close the first account and try to consolidate the second and third into a new account. Now print the accounts again, including the consolidated one if it was created.
I'm having difficulty with closing the first account then Consolidating :(. Here's my code so far with no errors so far.
//***********************************************************
// TestAccounts1
// A simple program to test the numAccts method of the
// Account class.
//***********************************************************
import java.util.Scanner;
public class TestConsolidation
{
public static void main(String[] args)
{
String name1;
String name2;
String name3;
double balance = 100.00;
int balance1;
int balance2;
int balance3;
//declare and initialize Scanner object
String message;
Scanner scan = new Scanner (System.in);
//Prompt for and read in the names
System.out.println ("What is the first name? ");
name1 = scan.next();
message = scan.nextLine();
//balance = balance1;
System.out.println ("The first name is: \"" + name1 + "\"");
System.out.println("The balance for this acoount is:" +balance);
System.out.println ("What is the second name? ");
name2 = scan.next();
message = scan.nextLine();
System.out.println ("The second name is: \"" + name2 + "\"");
System.out.println("The balance for this acoount is:" +balance);
System.out.println ("What is the third name? ");
name3 = scan.next();
message = scan.nextLine();
System.out.println ("The first name is: \"" + name3 + "\"");
System.out.println("The balance for this acoount is:" +balance);
}
}