COMPILES OK! BUT WHY DOESN'T IT RUN?

Hello,
I would really really appreciate some assistance on this piece of code. The following program is a simple Bank Account program which allows a user to view either their Savings or Current account details and displays the details. This piece of code compiles fine, but when I try and run it I get an error message:
Exception in thread "main" java.lang.nosuchmethoderror: main
I am not sure what this means, but I have a feeling its got something to do with the print_menu method? I am really new to Java and would appreciate some advice?
I am really sorry if the code is quite messy, i tried using the formatting tags but it doesn't work, or I am not sure if I am doing it correctly.
import javax.swing.*;
class BankAccount
     String name;
     String AcNo;
     double deposit;
     BankAccount() {}
     BankAccount(String aName, String aAcNo, double aDep)
          name = aName;
          AcNo = aAcNo;
          deposit = aDep;
     public void setName(String aName)
          name=aName;
     public void setAcNo(String aAcNo)
          AcNo = aAcNo;
     public void setDeposit(double aDep)
          deposit = aDep;
     public String getName()
          return name;
     public String getAcNo()
          return AcNo;
     public double getDeposit()
          return deposit;
     public double withDrawCash(double cash)
          if (cash <=deposit)
               deposit = deposit-cash;
               return(cash);
          else
          System.out.println("Not enough money in your account!");
          return (0);
public double DepositCash(double amount)
          if (amount >0.00)
               deposit = deposit+amount;
               return(amount);
          else
               System.out.println("Must be Positive number");
               return (0);
     public class cw13
          String t_option;
          int option;
          BankAccount myCurrentAc = new BankAccount("Rita", "553398", 2000);
          BankAccount mySavingsAc = new BankAccount ("Rita", "665522", 4000);
          BankAccount_with_statement Rita = new BankAccount_with_statement("Rita, 665522, 4000");
          public void main (String args [])
               String t_choice=JOptionPane.showInputDialog(null, "***Welcome to Personal Banking***\n\n" + "Please select account:\n" + "1. Current Account \n" + " 2. Savings Account" );
               int choice=Integer.parseInt(t_choice);
               print_menu(option);
public void print_menu(int option)
if (option==1)
               t_option=JOptionPane.showInputDialog(null,"Please enter your Account Number for your Current Account:");
               option=Integer.parseInt(t_option);
if (option==553398)
          t_option=JOptionPane.showInputDialog(null, "Below are your details for your current account \n" + "\n Balance:"+ myCurrentAc.getDeposit() + "\n Name: "+ myCurrentAc.getName() +"\n AcNo:" + myCurrentAc.getAcNo() + "\n What would you like to do:\n" + "3. View Statement \n" + "4. Withdraw Money\n" + "5. Deposit Money");
          option=Integer.parseInt(t_option);
     else if(option!=553398)
          t_option=JOptionPane.showInputDialog(null, "Invalid Account Number, Please try again");
          option=Integer.parseInt(t_option);
if(option ==2)
               t_option=JOptionPane.showInputDialog(null, "Below are your details for your Savings Account \n" + "\n Balance:" + mySavingsAc.getDeposit() + "\n Name: "+ mySavingsAc.getName() + "AcNo:" + mySavingsAc.getAcNo() + "\n What What would you like to do:\n" + "3. View Statement \n" + "4. Withdraw Money �20\n" + "5. Deposit Money �50");
               option=Integer.parseInt(t_option);
if(option==4)
          String c_cash=JOptionPane.showInputDialog(null, "How much would you like to Withdraw from your Current Account? \n");
          int cash = Integer.parseInt(c_cash);
          myCurrentAc.withDrawCash(cash);
          JOptionPane.showMessageDialog(null, "Your new balance is : " + myCurrentAc.getDeposit());
if(option==5)
          String c_cash=JOptionPane.showInputDialog(null, "How much would you like to Deposit into your Current Account? \n");
          int cash= Integer.parseInt(c_cash);
          myCurrentAc.DepositCash(cash);
          JOptionPane.showMessageDialog(null, "Your new balance is : " + myCurrentAc.getDeposit());
if (option==6)
          myCurrentAc.DepositCash(50);
          JOptionPane.showMessageDialog(null, "Your new balance is: " + myCurrentAc.getDeposit());

I did...I understand that I need to..but still get
errors!It works for me..
Havent really read the code, too messy.
But you need to implement BankAccount_with_statement before you can use it, so i just comented it away,added static, and it runs fine.
You have to make everyting that runs in main static first..., or move'em into main.
import javax.swing.*;
public class cw13 {
    static String t_option;
    static int option;
static BankAccount myCurrentAc = new BankAccount("Rita", "553398", 2000);
static BankAccount mySavingsAc = new BankAccount ("Rita", "665522", 4000);
//BankAccount_with_statement Rita = new BankAccount_with_statement("Rita, 665522, 4000");
public static void main (String args [])
String t_choice=JOptionPane.showInputDialog(null, "***Welcome to Personal Banking***\n\n" + "Please select account:\n" + "1. Current Account \n" + " 2. Savings Account" );
int choice=Integer.parseInt(t_choice);
print_menu(option);
public static void print_menu(int option)
if (option==1)
t_option=JOptionPane.showInputDialog(null,"Please enter your Account Number for your Current Account:");
option=Integer.parseInt(t_option);
if (option==553398)
t_option=JOptionPane.showInputDialog(null, "Below are your details for your current account \n" + "\n Balance:"+ myCurrentAc.getDeposit() + "\n Name: "+ myCurrentAc.getName() +"\n AcNo:" + myCurrentAc.getAcNo() + "\n What would you like to do:\n" + "3. View Statement \n" + "4. Withdraw Money\n" + "5. Deposit Money");
option=Integer.parseInt(t_option);
else if(option!=553398)
t_option=JOptionPane.showInputDialog(null, "Invalid Account Number, Please try again");
option=Integer.parseInt(t_option);
if(option ==2)
t_option=JOptionPane.showInputDialog(null, "Below are your details for your Savings Account \n" + "\n Balance:" + mySavingsAc.getDeposit() + "\n Name: "+ mySavingsAc.getName() + "AcNo:" + mySavingsAc.getAcNo() + "\n What What would you like to do:\n" + "3. View Statement \n" + "4. Withdraw Money �20\n" + "5. Deposit Money �50");
option=Integer.parseInt(t_option);
if(option==4)
String c_cash=JOptionPane.showInputDialog(null, "How much would you like to Withdraw from your Current Account? \n");
int cash = Integer.parseInt(c_cash);
myCurrentAc.withDrawCash(cash);
JOptionPane.showMessageDialog(null, "Your new balance is : " + myCurrentAc.getDeposit());
if(option==5)
String c_cash=JOptionPane.showInputDialog(null, "How much would you like to Deposit into your Current Account? \n");
int cash= Integer.parseInt(c_cash);
myCurrentAc.DepositCash(cash);
JOptionPane.showMessageDialog(null, "Your new balance is : " + myCurrentAc.getDeposit());
if (option==6)
myCurrentAc.DepositCash(50);
JOptionPane.showMessageDialog(null, "Your new balance is: " + myCurrentAc.getDeposit());
}

Similar Messages

  • Downloaded adobe flash but it doesn't work/run ??

    see above

    What is your operating system & version?
    What is your web browser?
    You downloaded Flash Player, but did you also install it?
    What exactly means "doesn't work/run"?

  • ITunes "opens" but why doesn't it respond?

    My iTunes "opens" but it doesn't respond nor shows anything after "openning." I attatched some pictures showing the process of me openning iTunes. It takes up 25% of my CPU and doesn't move.
    before-
    After attempting to openning iTunes-
    Task manager-

    Mine was doing the same after last update on a WIN 7 64 platform. Wouldn't open at all, or would open then crash immediately. Fixed it by follwing the instructions here to completely uninstall it and other parts......you MUST do it as instructed.
    http://support.apple.com/kb/HT1923
    Now I have the problem that it wont connect to the store, but that's another issue

  • Why doesn't Firefox run an adobe flash player slide show (no arrows to move to next/previous slide), but internet explore does?

    When I try to run a slide show in Firefox, the first slide displays but the arrows to move to next/previous slide do not appear. When I try in Internet Explorer, the arrows appear. Flash Player is enabled in Firefox. There must be another setting I need to adjust. I am running Windows 7. I don't see how to access Tools menu item in Firefox. I don't see where I can check my Firefox version. It is the current version as is Flash Player.

    When I try to run a slide show in Firefox, the first slide displays but the arrows to move to next/previous slide do not appear. When I try in Internet Explorer, the arrows appear. Flash Player is enabled in Firefox. There must be another setting I need to adjust. I am running Windows 7. I don't see how to access Tools menu item in Firefox. I don't see where I can check my Firefox version. It is the current version as is Flash Player.

  • Update never completes - always "connecting to update server" I can do manual update but why doesn't auto-update work?

    I have this same problem with three machines (all linux - different versions of linux & firefox). Yes, I could do a manual update. But, I would like to get the issue with auto-update sorted out. I have a common network setup: private IP (192.168.15.xxx) on a router connected to COMCAST. There is a firewall but no proxy.

    Thanks cor-el! Your question about how it was installed was spot on. It was installed as root (I always do that for an app like Firefox so that it is available to all users. That is also the default when installing apps with yum or other package managers). The solution is to run firefox as root (''kdesu firefox'') so that it has access to the installation folder for writing. I selected Help -> about firefox and it updated right away.
    The error for the mozilla people is in not detecting and either handling (asking for root privileges) or reporting the problem instead of hanging up in an infinite loop.
    Thank you.

  • I love Safari...But why doesn't it work with MySpace???

    For some reason MySpace is the only site I always have problems viewing images. On my home screen, 90% of my friends pictures all come as the blue box with the question mark. When I look at someone's page, almost all user pictures are blue boxes with question marks. Whenever I browse for users...again, almost every single picture comes up as a blue box with a question mark!
    Seriously, what gives? Every other site works perfectly and this problem with Safari and MySpace is the one thorn in otherwise superb browser.
    I've tried, emptying the cache, deleting cookies, clearing history...I've even Reset Safari multiple times...Still, even with the new update...Safari and MySpace images do not work!
    Can someone please help me shed some light on the situation...Cause it seems not many other people are having this problem. Thanks in advance.

    It probably says more about MySpace than Safari but anyway you could try the latest nightly build of Safari's Webkit web browser engine. I always use this now and find it offers greater all round performance.
    Try it and see if it helps.
    Just click the big 'Download Nightly builds' button on this page.
    http://webkit.org/
    In case you don't know, you just run the webkit application instead of Safari but in use it will seem no different than Safari because all you're doing is running an updated version of the rendering engine in Safari. Safari 3.1 remains untouched and you can switch back to that if you wish.

  • HT1338 Why doesn't safari run adobe flash player or adobe java?

    I keep getting error messages that both adobe java and adobe flashplayer are out of date.  I try to download the upgrade but it does not remain on the computer for future use.  I have a couple of programs that require these programs.  Are there any other programs that Apple allows me to use that will do the same as the Adobe programs?

    Adobe Flash Player 11.7.700.225
    Apple Java 2013-004 or Java SE Runtime Environment 7 1.7.0_25

  • No Compiling Error but doesn't work

    import java.awt.*;
    import java.awt.geom.*;
    import java.awt.event.*;
    import java.applet.*;
    public class javacw extends Applet implements KeyListener, Runnable
         Area pandaArea;
         Graphics2D g2d;
         // Providing coordinate control for the Panda
         int pandax=20, panday=50;
         // Animation condition. True = animate, False = static.
         boolean pandabool=false, laidOut=false;
         boolean left;
         boolean right;
         boolean up;
         boolean down;
    Thread animThread;
    Dimension offDimension;          // Defines an offscreen Dimension
    Image offImage;                    // Defines an offscreen Image
    Graphics offGraphics;          // Defines an offscreen Graphics
         Image panda;                    // Defines an Image object for panda
         public void init() {
              // Set the layout of the applet to null
              setLayout(null);
              panda = getImage(getCodeBase(), "panda.gif");
              public void keyTyped(KeyEvent event){}
              public void keyPressed(KeyEvent event)
                   if (event.getKeyCode() == KeyEvent.VK_LEFT) left = true;
                   if (event.getKeyCode() == KeyEvent.VK_RIGHT) right = true;
                   if (event.getKeyCode() == KeyEvent.VK_DOWN) down = true;
                   if (event.getKeyCode() == KeyEvent.VK_UP) up = true;
                   repaint();
              public void keyReleased(KeyEvent e)
                   if (e.getKeyCode() == KeyEvent.VK_LEFT) left = false;
                   if (e.getKeyCode() == KeyEvent.VK_RIGHT) right = false;
                   if (e.getKeyCode() == KeyEvent.VK_UP) up = false;
                   if (e.getKeyCode() == KeyEvent.VK_DOWN) down = false;
                   repaint();
    public void start()
              // Make sure the thread hasn already been created
         if (animThread == null) {
         animThread = new Thread(this, "anim");
         animThread.start();
    public void run() {
              // Create a current thread.
              Thread myThread = Thread.currentThread();
         // As long as the thread is created, keep redrawing the
         // canvas and then pausing for 10 miliseconds.
         while (animThread == myThread) {
                   repaint();
         try {
              Thread.sleep(10);
         } catch (InterruptedException e){}
    public void paint(Graphics g) {
              if (offImage != null) {
              g.drawImage(offImage, 0, 0, null);
         // Overide the update() method
    public void update(Graphics g) {
              Dimension d = getSize();
              // Create the offscreen graphics context
              if ((offGraphics == null)
              || (d.width != offDimension.width)
              || (d.height != offDimension.height)) {
              offDimension = d;
              offImage = createImage(d.width, d.height);
              offGraphics = offImage.getGraphics();
              // Erase the previous image
              offGraphics.setColor(getBackground());
              offGraphics.fillRect(0, 0, d.width, d.height);
              offGraphics.setColor(Color.black);
              paintFrame(offGraphics);               // Paint the frame into the image
              g.drawImage(offImage, 0, 0, null);     // Paint the image onto the screen
    public void paintFrame(Graphics g) {
              Graphics2D g2d = (Graphics2D)g;
              g2d.drawImage(panda, pandax, panday, this);
              if (pandabool) {               // If pandabool==true, animate the panda =)
                   if (pandax>400) pandax=0;
                   if(pandax<0)pandax=400;
    public void stop()
         animThread = null;
              offImage = null;
              offGraphics = null;
    public void destroy(){}
              public void Move ()
                   if (left) {
                        pandax-=10;
                   if (right) {
                        pandax+=10;
                   if (up){
                        panday-=10;
                   if (down){
                        panday+=10;
    i was trying to add the keylistener to makes my pic move and there are no compiling problem but it doesn't work when i press the key
    thx for everyone

    One problem might be your lack of a setVisible( true ). It would be easier to read if you put code tags around your code.

  • Java 1.4.1 will compile clean but it wont run them using windows ME

    haveing trouble setting the path and the class path for windows me
    the code compiles clean but when i go to run it
    its wont run it comes up with a error of no class defination found
    thanks dkunze

    The Windows path is a set of pointers that Windows uses to locate programs that you execute, like javac.exe and java.exe. This setting is explained here:
    http://java.sun.com/j2se/1.4.1/install-windows.html
    Scroll down to: 5. Update the PATH variable
    (you should have already done this as part of the Java installation)
    The CLASSPATH is another set of pointers that is used by Java to find the files that you create and want compiled and/or run. This setting is explained here:
    Setting the Classpath:
    http://java.sun.com/j2se/1.4.1/docs/tooldocs/windows/classpath.html
    [NOTE: always start your classpath with ".;" which means the current directory. See my classpath, below]
    How Classes are Found:
    http://java.sun.com/j2se/1.4.1/docs/tooldocs/findingclasses.html
    Examples:
    This is my path
    PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;C:\BATCH;C:\J2SDK1.4.1\BIN;C:\PROGRA~1\UTILIT~1;C:\PROGRA~1\WIN98RK
    This is my classpath
    CLASSPATH=.;C:\mjava;C:\mnrx;C:\NetRexx\lib\NetRexxC.jar;C:\j2sdk1.4.1\lib\tools.jar;C:\NetRexx\NrxRedBk

  • Why doesn't my MacBook Pro have this MacBook feature????

    I noticed that on my new black MacBook, under the System Preferences>Trackpad menu in system prefs, there is the option to "Use two fingers" on trackpad to simulate a double-click. This is brilliant from Apple, but Why doesn't my 2.0Ghz MacBook Pro have this option in the Trackpad preferences??
    My MacBook was signficantly cheaper than my MacBook pro. I wonder if we can expect this feature to be active on our MacBook Pros as well as the MacBooks. Seems like a dumb thing to leave off the high end laptop...
    Please Apple, Please activate the Two Button trackpad click on our macbooks via Software Update.

    I'm not sure if this will make you feel better or worse, but check out my thread about the issue here:
    http://discussions.apple.com/thread.jspa?threadID=488829&tstart=0
    To sum it up: I was in the Apple store a few days ago and I played with a 15" MBP that HAD the right-click w/ 2 fingers feature, which I thought was strange since people on here said it didn't exist on the 15" ones. Apparently, the machines in the store (or at least some of them) are running a newer build of OS X, either a newer 10.4.6 than we have access to, or a pre-release developer version of 10.4.7. Regardless, it seems 10.4.7 will add this feature, as was mentioned by a developer in that thread above who has the pre-release version of it and confirmed that his 15" now has that feature.
    So:
    Good news - it will work eventually, when they release 10.4.7.
    Bad news - you can't get it right now unless you're an ADC member.

  • What is, "Motion Calibration" and why is it always running?

    I recently upgraded from a 4s to a 6 so a lot of things are new to me. But why is, "Motion Calibration" running 24/7 in Location Services? Won't that nuke my battery?

    I think I might be able to answer this now, although it may be a little late in coming. The reason this setting was introduced was probably not to determine how many steps you take, but to correlate it more specifically to your distance. It must have been introduced when Apple started work on the Watch and realized they couldn't put GPS into it to measure distance running.
    Instead, blurbs on Apple's site say that the watch learns what your stride is based on a few runs with your iPhone. Because there is no third-party app the Watch can tap into in order to measure this, this setting must have been placed there in order for a user to be able to have these measurements ready for when they do purchase and pair their Watch with their iPhone. The Watch would then be immediately able to access both walking and running distance that had been measured more accurately by the iPhone for months. If you deactivate it, you can still get a very accurate step count, but the distance is a guesstimate based on your height. With Location Services enabled, Apple can measure distance much better, and this aids the fitness experience in the Apple Watch.

  • I import a MLB schedule into my iphone calendar.  Why doesn't it show up on my PC icloud website?

    I rectnely downloaded the Phillies schedule off their site.  Went to the "calendars" tab, imported, etc.  It is up and working on my iphone 4s.  No problem there.  But why doesn't it show up on my icloud?  I log in, all names, contacts, etc are there, but no Phillies schedule appears.  If everything from your phone syncs with the cloud, why isn't it working.  Thanks.

    Hi,
    Would you please let us have more info. Have you sync your iTunes library to your phone and ipad? What format did your import them as and what is the media kind?
    Jim

  • Backups/Transfers: why doesn't iBook simply mount up via FireWire?

    In backing up, I can turn on my external FW drive and boop, there it appears on my iMac desktop. No problem.
    To transfer files to/from my iBook, though, this doesn't work (at least not so far). I have to shut down either machine, connect the cables, and start one in Target mode. Fine -- can do.
    But WHY doesn't one Mac simply mount up on another's desktop via FW, as the external drive does? Or can it do it by changing a setting somewhere? Can anyone point out a setting or preference that will let me do this?
    Thanks,
    cb

    I began to perform the procedure that you suggested this evening with some strange results. I started my iMac in target disc mode, tiger dvd preloaded and firewire cable connected to the iBook and iMac. The iMac chimed and began to boot up but there was no display. I shut down the iMac with the power button and then noticed that the iBook had already shut down on its own. I removed the firewire cable, restarted the iMac several more times and even disconnected the power and let it rest for an hour but there is still no display. What could have happened? Is there possibly a short in the iBook that cooked my iMac? I would appreciate any ideas at this point.
    Thanks,
    Randy

  • It compiles and runs, but scrollPane doesn't work.

    Bah. Why doesn't my scrollPane work? It compiles and runs but my scrollbars for the text area are nowhere to be found. This is the code I'm using to handle my scrollpane.
    public Display() {
                   setLayout(null);
                   setPreferredSize(new Dimension(270, 300));
                   setSize(270, 300);
                   items = new JTextArea(5, 5);
                   items.setBounds(5, 5, 270, 260); //x,y,width,height
                   items.setEditable(false);
                JScrollPane scrollPane = new JScrollPane(items);
                scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
                scrollPane.setVerticalScrollBar(new JScrollBar(Scrollbar.VERTICAL));
                JScrollBar vScrollBar = scrollPane.getVerticalScrollBar();
                vScrollBar.setAutoscrolls(true);
                scrollPane.setVerticalScrollBar(vScrollBar);
                add(scrollPane, BorderLayout.CENTER);
                   add(items);
                   amount = new JTextField(".00");
                   amount.setBounds(5, 275, 266, 25);
                   amount.setHorizontalAlignment(JTextField.RIGHT);
                   amount.setEditable(false);
                   add(amount);
              }I'm also having a problem with this one. Apparently, my I uncomment this, the compiler says "cannot find symbol getImage()" which is odd because I've imported the proper package with this method.
    private ImageIcon icon = new ImageIcon("BKLogo.gif");
              public void paintComponent(Graphics background)
                   background.drawImage(background.getImage(), 0, 0, null);  
                   //setOpaque( false );
                   //super.paintComponent(background);
                   }

    You know what you need to do then: post an SSCCE (Short, Self Contained, Correct (Compilable), Example). For info on what this entails, look at these two sites:
    http://javafaq.mine.nu/lookup?22
    http://www.physci.org/codes/sscce.jsp

  • Whenever I try to update flash player it demands I close a dashboard client, but it doesn't say which one.  I have 10 of them running.  the installer must know which one, why doesn't it offer to close it (or them)?

    see the title.

    the installer doesn’t flag the clients…that’s the problem.  if I knew what it was complaining about I would kill it.  please don’t tell me the installer is really saying “kill all the dashboard clients”.  if that’s it then why doesn’t it offer to do it?  either a) it knows where the conflict is but won’t tell me;  or b) doesn’t know even if there is a conflict and leaves it up to me to guess.  great.  sure, I could kill them one by one and eventually find out which one, assuming the answer isn’t b), but I really think the installer could do a better job.  up to me there would be no flash clients and thus no issues.
    dxc

Maybe you are looking for

  • Playback Buttons and Thumbnails

    Hello Everyone and thanks fo ryour help in advance.  I am completely new to Flash and am just trying to get some of the basics correct.  I would like to create a Flash movie.  At the heart of my question is how to create a preview type of display on

  • There is no problem in Outlook but Lync does not start. → "Microsoft Lync cannot be started"

    hi, There is no problem in Outlook but Lync does not start. → "Microsoft Lync cannot be started" Addtional Info:Office2007(natural but 32bit)is in use. External devices except phone are not connected. Not able to understand the issue. vene tried unis

  • Maint order budgeting

    Hi, How to carry out budgeting in PM order. Client requirement is 1. Cost ctr wise budgeting - 5 Lacs Pls provide info reg config & transaction steps..like ko22,kpz2 I've not done budgeting before. Kindly guide me. Rgds, Thambi

  • I accidentally deleted my windows 8 partition.

    Hi. As the title states, i accidentally deleted and reformatted the partition that windows 8 was installed on, on my EliteBook 8570p, and now the recovery tool states that it is unable to restore because of a said missing partition. I was wondering i

  • The roundcube login displays when I open T.bird How do I open an account?

    When I open TB the only option is to create an email account. If I select this option a Roundcube log in screen appears. Do I need a Roundcube account and if so how do I get it Thanks, Julian