Question: what is the expected output from the following code: import javax.swing.JOptionPane; public class Samba { public static void main ( String [ ] args )

what is the expected output from the following code:

import javax.swing.JOptionPane;

public class Samba {

public static void main ( String [ ] args ) {

BankAccount bank = new BankAccount ( ) ;

String amount = JOptionPane.showInputDialog ( "Enter the statring amount:" ) ; // expect the user enter $20

bank.deposit ( amount ) ;

System.out.println ( "The curent amount is: " + bank . getBalance ( ) ) ;

}

}

public class BankAccount {

private double balance;

public void deposit ( double amount ) {

balance+= amount ;

}

public void withdraw ( double amount ) {

balance+= amount ;

}

public double getBalance ( ) {

return balance ;

}

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!