Results 1 to 4 of 4
Thread: Debug perspective launch error
- 10-28-2011, 01:22 AM #1
Member
- Join Date
- Oct 2011
- Posts
- 10
- Rep Power
- 0
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; } }
- 10-28-2011, 01:28 AM #2
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.
- 10-28-2011, 04:40 AM #3
Member
- Join Date
- Oct 2011
- Posts
- 10
- Rep Power
- 0
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)
- 10-28-2011, 04:42 AM #4
Similar Threads
-
[Netbeans] - Error Debug
By yuir in forum NetBeansReplies: 3Last Post: 01-03-2011, 07:01 PM -
Java Application fails to launch without error
By javaguy78 in forum AWT / SwingReplies: 9Last Post: 11-16-2010, 06:25 PM -
Help to debug a common error please!
By TaxpayersMoney in forum New To JavaReplies: 4Last Post: 05-08-2010, 03:31 PM -
Launch Error
By roughjj in forum EclipseReplies: 1Last Post: 10-30-2009, 07:59 PM -
error debug
By stid in forum EclipseReplies: 2Last Post: 10-16-2009, 07:44 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks