Results 1 to 4 of 4
  1. #1
    wndtjr2 is offline Member
    Join Date
    Oct 2011
    Posts
    10
    Rep Power
    0

    Default Debug perspective launch error

    I'm coding a banking system for homework.
    But When i put initial balance like $ 100 and trans code 1, and trans amount $200 which has to be less than initial balance to get minus balance.
    But before it shows result, it says "This kind of launch is configured to open the Debug perspective when it suspends. This Debug perspective is designed to support application debugging. It incorporates views for displaying the debug stack, variables and breakpoint management."
    and I have no idea what's wring with my coding.

    here is the instruction for this program
    "Write a class with methods to help you balance your checking account(an object class-main method is not in this class). The CheckingAccount Class should have at least two instance variables: the balance and the total service charges, along with methods to get and set each instance variables. You may add other variables and methods if you like. The program should read the initial balance for the month, followed by a series of transactions. For each transaction entered, the program should display the transaction data, the current balance for the account, and the total service charges. Service charges are $0.10 for a deposit and $0.15 for a check. If the balance drops below $500.00 at any point during the month, a service charge of $5.00 is assessed once for the month. Anytime the balance drops below $50.00, the program should print a warning message. If the balance becomes negative, an additional service charge of $10.00 should be assessed for each check until the balance becomes positive again. A transaction takes the form of an int number, followed by a double number. If the int number is a 1, then the double number is the amount of a check. If the int number is 2, then the double number is the amount of a deposit. The last transaction is 0 with no number to follow it."


    Java Code:
    import javax.swing.JOptionPane;
    
    
    public class bankAccount {
    	
    	private static double be500Charge = 5.00;
    	private static double be0Charge = 10.00;
    	private static double checkCharge = 0.15;
    	private static double depositCharge = 0.10;
    	static checkingAccount check;
    	static double balance;
    	
    	public static void main(String[] args) {
    		
    		// this program get initial balance, trans code to withdraw or make deposit, and enter money.
    		//then show the process of the result.
    		
    		double initialBalance, transAmount;
    		int transCode = 0;
    		String input;
    		
    		input = JOptionPane.showInputDialog("Enter your initial balance : ");
    		new checkingAccount((initialBalance) = Double.parseDouble(input));
    		
    		transCode = getTransCode();// transcode 1 = withdraw, transcode 2 = deposit
    		
    		while(transCode == 1 || transCode == 2){ //as long as trans code is 1 or 2, this program repeat.
    			
    			if(transCode == 1){
    				
    				transAmount = getTransAmount();
    				processCheck(transCode, transAmount);
    				getTransCode();
    			}
    			else if(transCode ==2){
    				
    				processDeposit(transCode);
    				getTransCode();
    			}
    		}	
    		processEnd();
    	}
    
    	public static int getTransCode(){
    		
    		String input;
    		int tCode;
    		input = JOptionPane.showInputDialog("Enter trans Code : ");
    		tCode = Integer.parseInt(input);
    		return tCode;
    		
    	}
    	
    	public static double getTransAmount(){
    		
    		String input;
    		double tAmount;
    		input = JOptionPane.showInputDialog("Enter trans Amount : ");
    		tAmount = Double.parseDouble(input);
    		return tAmount;
    		
    		
    	}
    	
    	private static void processCheck(int tCode, double tAmount){
    		balance = check.getBalance();
    		if(balance < 0){
    			check.setServiceCharge(be0Charge);
    			check.setServiceCharge(checkCharge);
    			JOptionPane.showMessageDialog(null, "Transaction: Check in amount of $" + tAmount
    					+ "\n Current Balance : $ " + balance
    					+ "\nService Charge : Check --- charge $ " + checkCharge
    					+ "\nWarning : Balance below $ 50"
    					+ "\nService Charge : Below $0 --- charge $" + be0Charge
    					+ "\nTotal Service Charge : $ " + check.getServiceCharge()) ;
    		}
    		else;
    		
    		
    	}
    	
    	
    	private static void processDeposit(int tCode){
    		
    		
    		
    		
    		
    		
    	}
    	private static void processEnd(){
    		
    		
    		
    		
    	}
    	
    }
    Java Code:
    public class checkingAccount{
          
    	private double balance = 0;
    	private double totalServiceCharge = 0;
    
    
    	public checkingAccount(double initialBalance){
    
    		balance = initialBalance;
    	}
    	public double getBalance(){
    		return balance; 
    	}
    	public void setBalance(double transAmt, int tCode){
    		if(tCode == 1)
    			balance -= transAmt;
    		else //if(tCode == 2)
    			balance += transAmt; 
    	}
    	public double getServiceCharge(){    
    		return totalServiceCharge;
     
    	}
    	public void setServiceCharge(double currentServiceCharge){
    		totalServiceCharge += currentServiceCharge;  
    	}
    
    }

  2. #2
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,789
    Rep Power
    7

    Default Re: Debug perspective launch error

    How are you running your code? That message looks like it might be some sort of configuration problem in your IDE.

  3. #3
    wndtjr2 is offline Member
    Join Date
    Oct 2011
    Posts
    10
    Rep Power
    0

    Default Re: Debug perspective launch error

    I made a mistake by clicking debug to start the program
    but when i start it without debug it has an error which is
    Exception in thread "main" java.lang.NullPointerException
    at bankAccount.processCheck(bankAccount.java:66)
    at bankAccount.main(bankAccount.java:32)

  4. #4
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,789
    Rep Power
    7

    Default Re: Debug perspective launch error

    Ok on line 66 something is null. Find out what is null. Find out why it is null. Correct it.

Similar Threads

  1. [Netbeans] - Error Debug
    By yuir in forum NetBeans
    Replies: 3
    Last Post: 01-03-2011, 07:01 PM
  2. Java Application fails to launch without error
    By javaguy78 in forum AWT / Swing
    Replies: 9
    Last Post: 11-16-2010, 06:25 PM
  3. Help to debug a common error please!
    By TaxpayersMoney in forum New To Java
    Replies: 4
    Last Post: 05-08-2010, 03:31 PM
  4. Launch Error
    By roughjj in forum Eclipse
    Replies: 1
    Last Post: 10-30-2009, 07:59 PM
  5. error debug
    By stid in forum Eclipse
    Replies: 2
    Last Post: 10-16-2009, 07:44 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •