import javax.swing.JOptionPane;
public class LocalApplication
{
public static void displayCredit()
{
double tempBalance = Credit.getCreditBalance();
JOptionPane.showMessageDialog( null, "Credit Balance = " + tempBalance );
}
public static void main(String[] args)
{
String response;
int choice = 0;
response = JOptionPane.showInputDialog("Do you want to modify Credits?");
if( response.equals( "yes" ) )
{
while( choice != 4 )
{
response = JOptionPane.showInputDialog("1 = Increase Credit , 2 = Decrease Credit, 3 = Show Current Credit, 4 = Quit");
choice = Integer.parseInt( response ); //needs error checking
switch( choice )
{
case 1:
Credit.increaseCredit( 1 );
break;
case 2:
Credit.decreaseCredit( 1 );
break;
case 3:
displayCredit();
break;
case 4:
// cleanup before quitting?
break;
default:
JOptionPane.showMessageDialog( null, "Sorry, please enter one of the digits from the menu" );
break;
} //end switch
} //end while
}
else
{
} // end if else
JOptionPane.showMessageDialog( null, "Thank you!" );
} //end main
} //end class