Answered You can hire a professional tutor to get the answer.
Java error "Account2 cannot be resolved to a type" The code in question is bellow: import java.
Java error "Account2 cannot be resolved to a type"
The code in question is bellow:
import java.util.Scanner;
public class ProcessTransactions
{
public static void main(String[] args)
{
Account2 acct1, acct2;
String keepGoing = "y";
int counter = 0;
int days;
String action;
double amount;
long acctNumber;
Scanner scan = new Scanner(System.in);
acct1 = new Account2(1000, "Sue", 123);
acct2 = new Account2(1000, "Joe", 456);
System.out.println("The following accounts are available:n");
System.out.println(acct1);
System.out.println();
System.out.println(acct2);
System.out.println("Please enter the number of days you would like to loop");
days = scan.nextInt();
while(counter < days)
{
counter++;
while(true)
{
if(counter != 1)
{
System.out.println("The following accounts are available:n");
System.out.println(acct1);
System.out.println();
System.out.println(acct2);
}
System.out.print("nEnter the number of the account you would like to access: ");
acctNumber = scan.nextLong();
System.out.print("Would you like to make a deposit (D) or withdrawal (W)? ");
action = scan.next();
System.out.print("Enter the amount: ");
amount = scan.nextDouble();
if (amount > 0) {
if (acctNumber == acct1.getAcctNum())
{
if (action.equals("w") || action.equals("W"))
{
acct1.withdraw(amount);
}
else if (action.equals("d") || action.equals("D"))
{
acct1.deposit(amount);
}
else
{
System.out.println("Sorry, invalid action.");
}
}
else if (acctNumber == acct2.getAcctNum()) {
if (action.equals("w") || action.equals("W"))
{
acct2.withdraw(amount);
}
else if (action.equals("d") || action.equals("D"))
{
acct2.deposit(amount);
}
else
{
System.out.println("Sorry, invalid action.");
}
}
else
{
System.out.println("Sorry, invalid account number.");
}
}
else
{
System.out.println("Sorry, amount must be > 0.");
}
System.out.print("nMore transactions? (y/n)");
keepGoing = scan.next();
if(keepGoing.equals("n"))
break;
}
System.out.println("nnnAccount Summary for Day: " + counter);
System.out.println("Total number of deposits for Accounts: " + acct1.numDep());
System.out.println("Total number of withdrawals for Accounts: " + acct1.numWithdrawals());
System.out.println("Amount deposited for accounts: " + acct1.Deposited());
System.out.println("Amount withdrawn for accounts : " + acct1.WithDrew());
acct1.Reset();
acct2.Reset();
}
}
}