Question
must be in java: Create a BankAccountPlusTester (this should be the main) Import Scanner Create a Scanner object Create a name and balance local variable.
must be in java:
Create a BankAccountPlusTester (this should be the main)
Import Scanner
Create a Scanner object
Create a name and balance local variable.
Create 3 BankAccountPlus objects by:
Ask the user for a name and add it to the variable name.
Ask the user for an opening balance and add it to the variable balance.
Create the account with the information provided from the user.
Dont forget you many need to add extra in.nextLine() like we did in a previous lab.
Create a fourth BankAccountPlus object that will have the name dummy and no balance.
Call payFees for each account.
Print the name and balance for each account. Be sure and use words to describe what each output means.
the code I have:
import java.util.Scanner; public class BankAccountPlusTester { public static void main (String[] args) { Scanner in = new Scanner(System.in); String name; double balance; // create 3 BankAccountPlus object s BankAccountPlus account1,account2, account3; for(int i=1;i<=3;i++) { System.out.println("For Account # "+i); System.out.println("Please enter your name : "); name=in.nextLine(); System.out.println("Please enter Initial Balance : "); balance =in.nextDouble(); //clear the Buffer in.nextLine(); if(i==1) { //Create account and call pay fees account1=new BankAccountPlus (balance, name); account1.payFees(); System.out.println(account1); } if(i==2) { //Create account account2=new BankAccountPlus(balance, name); account2.payFees(); System.out.println(account2); } if(i==3) { //Create account account3=new BankAccountPlus(balance, name); account3.payFees(); System.out.println(account3); } } } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started