Guest User

Untitled

a guest
May 22nd, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.56 KB | None | 0 0
  1. /*
  2.  * To change this template, choose Tools | Templates
  3.  * and open the template in the editor.
  4.  */
  5. package javaapplication1;
  6. import javax.swing.JOptionPane;
  7. /**
  8.  *
  9.  * @author Cody
  10.  */
  11. public class JavaApplication1 {
  12.  
  13.     public class BankAccount{
  14.         float balance;
  15.         float interestRate;
  16.         //String compondPeriod;
  17.         public BankAccount() {
  18.             this.balance = 0.00;
  19.             this.interestRate = 0.00;
  20.             //this.compondPeriod="";
  21.         }
  22.        
  23.         /*
  24.          public float calculateBalance(int compoundPeriod){
  25.             for(int i = compoundPeriod;i>0;i--){
  26.                 this.balance *= 1+interestRate;
  27.             }
  28.            
  29.         }
  30.        */
  31.     }
  32.    
  33.     public static void main(String[] args){
  34.         BankAccount account1;
  35.         String balance = JOptionPane.showInputDialog(null, "Please enter the amount in your account");
  36.         String interestRate = JOptionPane.showInputDialog(null, "Please the interest rate in %");
  37.        
  38.         account1.interestRate = Integer.parseInt(interestRate);
  39.         //account1.compoundPeriod = JOptionPane.showInputDialog(null, "Please enter ")
  40.         account1.compoundPeriod ="12";
  41.         JOptionPane.showMessageDialog(null, "If your account had a compound period of " + compoundPeriod);
  42.        
  43.         sayHelloTo(balance);
  44.         // TODO code application logic here
  45.     }
  46.    
  47.     public static void sayHelloTo(String nameToGreet){
  48.         JOptionPane.showMessageDialog(null, "Hello, " + nameToGreet + "!");
  49.     }
  50.    
  51.    
  52.    
  53. }
Add Comment
Please, Sign In to add comment