Advertisement
Guest User

Untitled

a guest
Dec 17th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.54 KB | None | 0 0
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package computationtest;
  7.  
  8. import javax.swing.*;
  9.  
  10. /**
  11.  *
  12.  * @author Acer01
  13.  */
  14. public class ComputationTest {
  15.  
  16.     /**
  17.      * @param args the command line arguments
  18.      */
  19.     public static void main(String[] args) {
  20.         // TODO code application logic here
  21.         String date[] = new String[10];
  22.         String debbit[] = new String[10];
  23.         int amount1[] = new int[10];
  24.         String credit[] = new String[10];
  25.         int amount2[] = new int[10];
  26.         String ans, save = null, ask, yes = null;
  27.         Integer integerAmount1, integerAmount2;
  28.         int c = 0;
  29.        
  30.         do{
  31.             date[c] = JOptionPane.showInputDialog("enter date: ");
  32.             debbit[c] = JOptionPane.showInputDialog("debbit name: ");
  33.             amount1[c] = Integer.parseInt(JOptionPane.showInputDialog("amount1: "));            
  34.             credit[c] = JOptionPane.showInputDialog("credit name: ");
  35.             amount2[c] = Integer.parseInt(JOptionPane.showInputDialog("amount2: "));
  36.            
  37.            
  38.             c++;
  39.            
  40.           ans = JOptionPane.showInputDialog("enter new? Yes/No");
  41.         }while(ans.equalsIgnoreCase("yes"));
  42.         ask = JOptionPane.showInputDialog("enter number: ");
  43.        
  44.         for(c = 0; c < date.length; c++){
  45.             save = date[c];
  46.             if(ask.equals(save)){
  47.             JOptionPane.showMessageDialog(null, "Date: " + date[c] +
  48.                     "\n debbit: " + debbit[c] +
  49.                     "\n amount: " + amount1[c] +
  50.                     "\n : credit: " + credit[c] +
  51.                     "\n amount: " + amount2[c]);
  52.                     c++;
  53.             }
  54.            
  55.         }
  56.         ans = JOptionPane.showInputDialog("do you want to compute?");
  57.             if(ans.equalsIgnoreCase("yes"))
  58.                 {
  59.                     ans.equalsIgnoreCase("yes");
  60.                 }
  61.                 else if(ans != yes)
  62.                 {
  63.                     JOptionPane.showMessageDialog(null, "Okay");
  64.                 }
  65.                 ask = JOptionPane.showInputDialog("enter name you want to compute: ");
  66.                     save = debbit[c];
  67.                     save = credit[c];
  68.                     if(ask.equals(save)){
  69.                        JOptionPane.showMessageDialog(null," total: " + (amount1[c] + amount2[c]));
  70.                     }
  71.            
  72.     }
  73.    
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement