New to Java - why won't my program run ?

Hi
I am new to Java - this compiles but does not run - any suggestions please ?
class ThinkofANumberApp extends basic{
     public static void main (String param[]) throws Exception
     input source = new input ();
     output sink = new output ();
     int result = source.readint();
     //list number questions for numbers
          sink.writeln("Think of a number");
          source.readln();
          sink.writeln("Multiply it by 5");
          source.readln();
          sink.writeln("Add 6");
          source.readln();
          sink.writeln("Multiply it by 4");
          source.readln();
          sink.writeln("Add 9");
          source.readln();
          sink.writeln("Multiply it by 5");
          source.readln();
          sink.writeln("Type the final result");
          sink.write("My \"guess\" is that your"
          + " original number was ");
          sink.writeln((result-165)/100);
Thanks in advance.
Nadjie

What is "input" and "output" and have you included these classes in your classpath?

Similar Messages

  • Why won't JavaFX programs run?

    I'm running Ubuntu 10.04 and firefox. If I go to http://javafx.com/samples/ and try to launch one of the samples I get redirected to a page that says I need a newer version of java.
    If I run java -version from the command line I get:
    java version "1.6.0_20"
    Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
    Java HotSpot(TM) Server VM (build 16.3-b01, mixed mode)
    This is the same version as the one the web page wants me to download. Why won't these demos launch?
    thanks,
    William
    Edited by: wwuster on Jun 16, 2010 7:13 AM

    Generally, there are some additional steps to configure the sun java plugin for firefox browsers on Unix systems
    http://java.com/en/download/help/linux_install.xml. Scroll down to the firefox section to get a sense of how to do it.
    A quick and fast solution (without configuration) to see the demos is to click on the launch button above each demo sample and then open it with javaws (from the bin directory of your java installation). Hope this helps!
    -Dhruva
    Edited by: d2j on Jun 16, 2010 10:29 PM

  • Why won't my program run when I schedule it.

    I am trying to schedule an executable and it says it is successful, but the program never runs.  I even tried setting up a simple batch file that will call the program and when I schedule it it says successful but never runs. When I run it on the desktop of the server it runs fine and the batch job runs fine.  I have tried configuring it several different ways and adding supporting files.  I have never scheduled a program in this application, so I'm sure I'm just missing something.  Can someone please tell me how to set this up or give me an example.  It is driving me crazy.

    1. Reset iPad
    2. Change the USB cable
    3. Try another charger

  • New to JAVA, but old school to programming

    Objects & Classes & Methods, Oh my!
    I'm pretty new to java, but I've been programming in several languages over the years. I thought it was about time to update my skill set, especially with the job market as it is today. I wanted to go JAVA because it's not specific to any environment.
    I picked up a begining JAVA book and was a little confused. When I was learning programming a program was called a program. a peice of code in a program called by a statement was called a subroutine (it was performed then control returned to the calling line and continued).
    Now I'm trying to make sense of everything I have read so far and trying to relate it back to my old school of thinking. I was hoping it would make it easier to retain and I could expand it as I learn and possibly realize that it IS different. I know it's a new way of thinking, but stay with me for minute.
    What I used to call a program is now a CLASS in JAVA (this can be a collection of code or other objects). A sub-routine in a CLASS is a Method. I know that the language part will come as I use it since I understand if's then's and whatever you use to gosub or goto, but I want to make sure I have down the lingo before I go to deep.

    I have no idea how you can compare Java to Cobol.
    DataFlex? How about that! In about '84 I switched to
    DataFlex from dBaseII. In '91 DataFlex changed from
    procedural to OOP. It took most of us at least a year
    to adjust, and then some to write concrete code. It
    was tough. They had bugs and we were limited with DOS.
    BUT, it was a great OOP training experience. Anyhow,
    needless to day Java is miles ahead on all fronts.Small world. I was stuck in the old DataFlex Ver 2.3 at that time. The company I worked for had the newer OOP package. I did get to work with it some, but not enough to become totally familiar with it. We started to move out of DataFlex towards PowerBuilder towards the end of 1995. I did get some OOP from that experience, but again only enough to learn about global variables, instance variables, and a few other items. I hoping that I will be able to get the solid OOP background that I need from JAVA since I hear through the grapevine that it may be a new tool that we will be looking at to enhance our programming. I was looking at PERL but even the PERL programmers we have agree that JAVA is more scalable.

  • Why won't Elements 5 run?

    Why won't Elements 5 run on my Win 7 Pro machine?  When this custom machine was  first set up, all the programs running on my prior Dell Win XP machine were installed on this machine, including Elements 5.
    Recently, my hard drive crashed and the mfg couldn't install most of the programs I had, including Elements 5. I still had the original disk and installed the program. It went through the installation and put a shortcut on my desktop. Unfortunately, when I clicked on the short cut, nothing happened. I went to the location of the the executable file and clicked on it. Same thing.
    I went to my tech support company and they helped me uninstall the program and we "repaired" the program but it still wouldn't run. We reinstalled from the CD and it still wouldn't run.
    Is there anyway, I can get my program to run? If it comes down to having to purchase a new program, I'll just use the Windows photo program. I think whatever is going on is lousy!

    Did you try right clicking and run as administrator?
    You could also try setting up a new user account an see if it will run from there.
    I'm running  version 5 on one machine with W7 Pro 64 bit with no problems.

  • Please why doesn't some programs run on the osx mavericks the way it ran on the osx mountain lion, for example , the wizard 101 installer keeps freezing on maverick. Help me !!!

    please why doesn't some programs run on the osx mavericks

    Some apps require updating when a new operating system comes out. Check with the developers of the apps you're having problems with and see if they have an update or workaround.
    Regards.

  • Why won't photoshop cc run portraiture 2

    why won't photoshop cc run portraiture 2?? Am I doing something wrong?

    Yes, you aren't giving us enough information to help you.
    What version of Photoshop?
    What OS version?
    Why is portraiture2 not working?
    Have you contacted the makers of that plugin?

  • Why won't Photoshop CC run on my laptop I just installed it today

    Why won't Photoshop CC run on my laptop I just installed it today. I signed out on my desktop but the laptop still will not run Photoshop CC. It starts but then closes itself down immediately after starting.

    Well it is the same Win7 that is running on my desktop and yes I have an internet connection and at that time is was hard wired not wireless. I just downloaded and installed the Photoshop and Bridge Apps. The laptop is about 2 yrs old and it is a high end machine and Photoshop6 runs on it just fine. I sure wish someone from Adobe would answer this question as it is beyond frustrating to me that this stuff works so poorly and you can never get a good answer out of them about anything ever.

  • Why won't my MacBook run on battery and display on the monitor?      Runs fine if power cord is plugged in.                                                                                      I have to be plugged in to see the monitor display.  Any ideas

    Why won't my laptop run on battery and display on the monitor?  If it is plugged in to power it works fine but the monitor goes blank if the power cord is removed.  Any ideas?

    Nothing is wrong.  what your're seeing is by design.

  • I'm new to Java. Whats the easiest program to make games?

    I'm a moderately experience flash actionscript 3 developer, so i know how to program.
    I just want to know a developers kit that is good for making simple 2d games. Are there kits, that help you with the graphics stuff, like flash does? Because i suppose in Java you have to load all the sprites etc mannually?
    So i'm looking for an easy developer's kit for Java games.

    omniscient wrote:
    game maker is very limited. I want to use the java language.Okay but why do you want to use java? What do you think it offers you over something like GameMaker (especially if you're relying on prebuilt libraries)? If we know your actual goals (what kind of game do you want to make? How do you plan to get started? How much programming do you already know?), we can better help you.
    I'll check the tutorial.Always a good start. If you're unfamiliar with java in general, I wouldn't touch anything GUI-related until you master the [basic tutorials|http://java.sun.com/docs/books/tutorial/java/index.html] first.
    But I don't understand why you're so negative. What's wrong with wanting to use a kit thats easy- to use, and has all the basic stuff ready for you?I didn't mean to come off as negative. The problem with using a "kit" is that it gets in the way of actually learning how to program. I'd recommend getting a really basic game going on your own (think pong), and then worry about adding on to it using third party libraries. Learning how to do the basics (which really aren't that hard to start) will give you a better idea of what you need: physics engine? More accurate collision detection? Special effects? Smoother animation? Artificial intelligence? The list is endless, and I doubt you'll find all of it in one prebuilt kit. What fun would that be anyway!
    Ofcourse i know i dont ahve to draw pixel per pixel, i was exaggerating.Ok phew, you had me worried for a second.
    All this being said, I love seeing what other people come up with. Keep us posted on your progress, and feel free to ask questions as you go along.

  • Why won't my programs start properly when I install 6u12 - 6u14?

    Hello all
    I'm not sure if this is the right place to post this, but I'm having some frustrating issues w/ programs after I install update 14 (I tried 12 and 13 too).
    This is a confusing story, but basically I have this issue where programs seem to start properly (this includes Netbeans and an application that I've developed and try to run w/in Netbeans) but the interface components never totally paint themselves. I see the program as running in the bottom program bar, but I cannot do anything w/ the program. I've been messing w/ settings, but I cannot completely trace/solve the problem. What I DO know is that if I fall back to version 1.6.0_04, all my programs work fine.
    Any thoughts? I'm hesitant to deploy a new version of our application w/ the latest Java version at this point.
    Thanks for any help
    Brent

    The only consistent problem posts I have seen involve 14. And there aren't really a lot of those.
    You might have some unusual situation. Or the cause might be something completely bizarre.

  • Why won't my program work??

    when i try to run it, all i get is a window that comes up..
    i'm trying to make a 9-box pattern on the screen
    import javax.swing.*;
    public class Quilt
        public static void main (String[] args)
            JFrame frame = new JFrame ("Quilt");
            frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
            QuiltPanel panel = new QuiltPanel();
            frame.getContentPane().add(frame);
            frame.pack();
            frame.setVisible(true);
    }and
    import javax.swing.*;
    import java.awt.*;
    public class QuiltPanel extends JFrame
        private final int NUM_SQUARES=9;
        public QuiltPanel ()
            setBackground (Color.black);
            setPreferredSize (new Dimension(300,300));
        public void paint (Graphics g)
               int x = 0;
               int y = 0;
               g.setColor (Color.green);
               for (int count = 0; count < NUM_SQUARES; count++){
                   while (x<=200){
                        count++;
                        g.setColor (Color.green);
                        g.fillRect (x, y, 100, 100);
                        x=x+100;
                   x = 0;
                   y = 100;
                   while (x<=200){
                        count++;
                        g.setColor (Color.green);
                        g.fillRect (x, y, 100, 100);
                        x=x+100;
                   x = 0;
                   y = 200;
                   while (x<=200){
                        count++;
                        g.setColor (Color.green);
                        g.fillRect (x, y, 100, 100);
    }

    captmorgan, how do i give dukes?
    paulcw, i'd try that out, but for this assignment we have to repeat a pattern using loops,etc
    anyone know why this doesn't show correctly?
    import javax.swing.*;
    import java.awt.*;
    public class QuiltPanel extends JPanel
         public static void main (String[] args)
            JFrame frame = new JFrame ("Quilt");
            frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
            QuiltPanel panel = new QuiltPanel();
            frame.getContentPane().add(panel);
            frame.pack();
            frame.setVisible(true);
        private final int NUM_SQUARES=9;
        private static int size;
        public QuiltPanel ()
            size = Integer.parseInt(JOptionPane.showInputDialog(null, "What's the scaling of the quilt?"));
            setPreferredSize (new Dimension(300*size,300*size));
        public void paintComponent (Graphics g)
               super.paintComponent (g);
               int x = 0;
               int y = 0;
               int count = 0;
               while (count < NUM_SQUARES){
                   while (x<=200*size){
                        count++;
                        g.setColor (Color.green);
                        g.fillRect (x*size, y*size, 100*size, 100*size);
                        g.setColor (Color.black);
                        g.fillRect ((x+10)*size, (y+10)*size, 35*size, 35*size);
                        g.fillRect ((x+55)*size, (y+10)*size, 35*size, 35*size);
                        g.fillRect ((x+10)*size, (y+55)*size, 35*size, 35*size);
                        g.fillRect ((x+55)*size, (y+55)*size, 35*size, 35*size);
                        g.setColor (Color.blue);
                        g.fillOval ((x+40)*size, (y+40)*size, 20*size, 20*size);
                        x=x+(100*size);
                   x = 0;
                   y = 100*size;
                   while (x<=200*size){
                        count++;
                        g.setColor (Color.green);
                        g.fillRect (x*size, y*size, 100*size, 100*size);
                        g.setColor (Color.black);
                        g.fillRect ((x+10)*size, (y+10)*size, 35*size, 35*size);
                        g.fillRect ((x+55)*size, (y+10)*size, 35*size, 35*size);
                        g.fillRect ((x+10)*size, (y+55)*size, 35*size, 35*size);
                        g.fillRect ((x+55)*size, (y+55)*size, 35*size, 35*size);
                        g.setColor (Color.blue);
                        g.fillOval ((x+40)*size, (y+40)*size, 20*size, 20*size);
                        x=x+(100*size);
                   x = 0;
                   y = 200*size;
                   while (x<=200*size){
                        count++;
                        g.setColor (Color.green);
                        g.fillRect (x*size, y*size, 100*size, 100*size);
                        g.setColor (Color.black);
                        g.fillRect ((x+10)*size, (y+10)*size, 35*size, 35*size);
                        g.fillRect ((x+55)*size, (y+10)*size, 35*size, 35*size);
                        g.fillRect ((x+10)*size, (y+55)*size, 35*size, 35*size);
                        g.fillRect ((x+55)*size, (y+55)*size, 35*size, 35*size);
                        g.setColor (Color.blue);
                        g.fillOval ((x+40)*size, (y+40)*size, 20*size, 20*size);
                        x=x+(100*size);
    }

  • Why won't the program fully open?

    I bought Adobe Premiere Elements 8 a while ago but have lacked a computer that could handle it properly. I recently bought a powerful laptop so I installed Premiere Elements 8 right away, hoping to edit some videos. Unfortunately for some reason it can't open fully. I will choose a name and destination to save the project but when I try to actually work with the program it freezes on me, not telling me what is wrong.
    I have tried uninstalling and reinstalling to the same result. What can I try?

    How much free, clean, freshly defragmented space is on your C drive? Brand new computers can be a mess of fragmentation and temp files. First, ensure you have at least 20-30 gigs of free space. Then run this free program to clean things off:
    http://www.iobit.com/advancedsystemcareper.html
    Then defragment your drive.
    Also, manually go to Windows Update and ensure you have even the non-critical updates. And go to Apple.com and ensure you have the latest version of Quicktime per the program's requirements.
    If it still won't open, please provide us more information about your computer including your operating system, your processor speed and your RAM load.

  • HT4623 My iPad is version 5.1.1 and says it's up to date. Yet some apps need a newer iOS. Why won't it get a newer iOS?

    My iPad won't update to a newer version of iOS? What am I overlooking or is this product no longer upgradable?

    If it's the first gen iPad (i.e. the one without cameras) then iOS 5.1.1 is the highest version of iOS that it supports - mine got noticeably slower with iOS 5, I doubt that it could cope with iOS 6 or 7 (it has a slow processor and only have the RAM of the iPad 2, and the 3rd gen onwards have double again).
    Some developers allow you to download previous compatible versions of their apps. If an app is free then you coul try downloading the current version on your computer's iTunes so that the app is in your purchase history. Then on your iPad go to the Purchased tab in the App Store app and see if you can download an older compatible version of it.

  • I am trying to install a trial version of Adobe CC, and it keeps telling me that I  need to connect to the internet. I am connected to the internet, why won't the program install?

    I have downloaded the trial version of Adobe Cloud, but when I try to install the program, it keeps telling me to connect to the internet. I AM connected to the internet. What am I doing wrong?

    No, we don't phone. Sorry, not how forums work. We are not Adobe staff.
    1. What is the exact message you get when trying to download?
    2. What specific things have you tried? Please be exact. Give links to pages with advice you have followed, and tell us what happened.

Maybe you are looking for

  • Where can I download missing "Minion Pro" and "Myriad Pro" type fonts?

    For some reason I have fewer Minion Pro & Myriad Pro type fonts on my Windows 7 home computer than I do on my Windows 7 work computer, and I'm trying to do the same commercial project with both of them. I have subscribed to Creative Cloud for over a

  • Getting Error while installing Adobe CS5.5 Master Collection

    I have downloaded a Adobe CS5.5 Master Collection while installing it shows me an error ( Please insert Disk Adobe Master Collection 5 Trial English to continue ) Exit Code: 24 -------------------------------------- Summary --------------------------

  • On the order of permissions in "Get Info" window

    I know that the three permissions listed are Owner, Group and Others. Is there any significance to the order in which they are listed? or only to the rights assigned each (Unknown is showing up on some of my files, I presume because of a recovery fro

  • Unable to install Java Version 7

    I currently have Java Version 6 loaded. I downloaded the latest version of Java Version 7. It was a pkg installer. When I ran it it said I couldn't install it because I didn't download it from the Apple Store. Also there is no Java panel in the Syste

  • Command-X deletion is _too_ final

    While in Mail yesterday, I learned the hard way that accidentally hitting the Command and the X keys at the same time - not difficult to do as one is right above the other on my keyboard - results in the permanent deletion of the highlighted message