Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need help with a java programm that requires you to create a checking account,

ID: 3621961 • Letter: I

Question

I need help with a java programm that requires you to create a checking account, here's the question:
Create a class named CheckingAccount with data fields for an account number and a balance. Include a constructor that takes arguments for each field. The constructor sets the balance to 0 if it is below the required $200.00 minimum for an account. Also include a method that displays account details, including an explanation if the balance was reduced to 0. Write an application named TestAccount in which you instantiate two checkingAccount objects, prompt the user for values for the account number and balance, and display the value of both accounts.

Explanation / Answer

please rate - thanks

class CheckingAccount
{
int accountNumber;
double balance;
public CheckingAccount (int n, double b)
{accountNumber=n;
if(b<200)
    balance=0;
else
    balance=b;
}

public void details()
{System.out.println("Account Number: "+accountNumber);
System.out.println("Account Balabce: "+balance);
if(balance==0)
      System.out.println("balance reduced to 0 since it was under the minimum $200");
System.out.println();                   
}
}

---------------------------------

import java.util.*;
class TestAccount
{
public static void main(String[] args)
{Scanner in=new Scanner(System.in);
int n;
double bal;
System.out.println("for account a:");
System.out.print("enter account number(integer): ");
n=in.nextInt();
System.out.print("enter account balance: ");
bal=in.nextDouble();

CheckingAccount a=new CheckingAccount(n,bal);
System.out.println("for account b:");
System.out.print("enter account number(integer): ");
n=in.nextInt();
System.out.print("enter account balance: ");
bal=in.nextDouble();

CheckingAccount b=new CheckingAccount(n,bal);
a.details();
b.details();
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote