Results 1 to 7 of 7
  1. #1
    proboundz is offline Member
    Join Date
    Nov 2012
    Posts
    13
    Rep Power
    0

    Question Need help with a program

    Hello

    I am trying to write a program that takes two numbers and multiplies them. I got this idea from this running conversion program

    import java.util.Scanner;

    public class Convert
    {
    public static void main (String [] args)
    {
    Scanner reader = new Scanner (System.in);
    double farenheit;
    double celsius;

    System.out.print("Enter Farenheit:");
    farenheit=reader.nextDouble();

    celsius=(farenheit-32.0) * 5.0 / 9.0;

    System.out.print("The Celsius is:");
    System.out.println(celsius);

    }
    }




    Anyways here i my current code



    import java.util.Scanner;
    public class FDR {
    public static void main (String [] args)
    {
    Scanner input = new Scanner(System.in);
    double alpha;
    double beta;
    double output;

    System.out.print("Enter number 1");
    alpha= input.nextDouble();

    System.out.print("Enter number 2");
    beta=input.nextDouble();

    ouput= (alpha * beta);

    System.out.print("The answee is");
    System.out.print(output);
    }
    }



    i am getting a cant find symbol for the output = (alpha*beta) line

    What is wrong.

    Also, am I using the reader object correctly ? hould I create two reader objects as there are 2 inputs needed?

    Thank in advance. :)

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is online now Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,969
    Rep Power
    8

    Default Re: Need help with a program

    One variable is output. The other is ouput. Notice that one of them has two Ts, the other only has one.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    proboundz is offline Member
    Join Date
    Nov 2012
    Posts
    13
    Rep Power
    0

    Default Re: Need help with a program

    Whoooppss This seems to be a common occurrence with my programs. Can you recomend any other programs that can check my spelling and also run my program directly. Does any such thing exist?

    thanks

  4. #4
    KevinWorkman's Avatar
    KevinWorkman is online now Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,969
    Rep Power
    8

    Default Re: Need help with a program

    You could look into using an IDE like eclipse or netbeans. But the compiler is your best friend.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  5. #5
    proboundz is offline Member
    Join Date
    Nov 2012
    Posts
    13
    Rep Power
    0

    Default Re: Need help with a program

    Thanks for your help

    I just had the idea to ask the user if he wants to add/mult/div/or subt. Is there a simple way I can do this? Can I set a variable as a symbol ?

    The only idea that comes to mind is: Ask user what he wants then use 4 if/else statements.

    Any ideas?

  6. #6
    KevinWorkman's Avatar
    KevinWorkman is online now Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,969
    Rep Power
    8

    Default Re: Need help with a program

    Using an if statement is a reasonable way to go. You could get more complicated, but it's better to start with the simpler solution first.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  7. #7
    KevinWorkman's Avatar
    KevinWorkman is online now Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,969
    Rep Power
    8

    Default Re: Need help with a program

    Please post the full text of your command prompt, including your directory structure.
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. Replies: 6
    Last Post: 12-15-2013, 06:40 AM
  2. Replies: 4
    Last Post: 11-21-2012, 01:19 PM
  3. Replies: 2
    Last Post: 04-02-2011, 12:57 PM
  4. Replies: 13
    Last Post: 03-22-2011, 06:49 AM
  5. changing my program to array working program
    By Chewart in forum New To Java
    Replies: 39
    Last Post: 11-18-2009, 06:53 PM

Tags for this Thread

Posting Permissions

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