Results 1 to 5 of 5

Thread: Need help!!!!!!

  1. #1
    mcnam4119 is offline Member
    Join Date
    Sep 2010
    Location
    Singapore
    Posts
    13
    Rep Power
    0

    Exclamation Need help!!!!!!

    I need to create a calculator program on JCreator and it must have a printout similar to this program:
    import java.io.*;
    public class dowhilecode {

    public static void main(String[] args)throws IOException {
    BufferedReader abc=new BufferedReader (new InputStreamReader (System.in));
    System.out.println("1. Addition");
    System.out.println("2. Subtraction");
    System.out.println("3. Multiplication");
    System.out.println("4. Division");
    System.out.println("5. Exit");
    System.out.println("");
    System.out.println("Choose a menu option");
    int numberone=Integer.parseInt(abc.readLine());
    System.out.println("");
    System.out.println("Enter the first number");
    int numbertwo=Integer.parseInt(abc.readLine());
    System.out.println("");
    System.out.println("Enter the second number");
    int numberthree=Integer.parseInt(abc.readLine());

    switch(numberone)
    {
    case 1: //addition
    System.out.println(numbertwo+"+"+numberthree+"="+( numbertwo+numberthree));
    break;

    case 2: //subtraction
    System.out.println(numbertwo+"-"+numberthree+"="+(numbertwo-numberthree));
    break;

    case 3: //multiplication
    System.out.println(numbertwo+"x"+numberthree+"="+( numbertwo*numberthree));
    break;

    case 4: //division
    System.out.println(numbertwo+"/"+numberthree+"="+(numbertwo/numberthree));
    break;

    case 5: //exit
    System.out.println("Exiting Program");
    break;

    }
    }
    }
    Except that I must use functions instead of just cases and dowhile code. The code above prints the menu then you choose an option with an integer and then it asks you for 2 numbers and depending on the menu option you chose it will calculate the answer, unless of course you chose exit.
    However in the new and improved calculator using functions I must print the same thing except it must ask if you wish to continue with more calculations at the end where it loops back to the menu or exits.
    Plz help I only have 2-3 days to do this. If there is trouble understanding what I need to do then you can ask me.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    You may wish to reply to helpful replies in your previous thread, since without them, we can only assume that you never read them and will likewise not read replies in this thread. Also, you may with to show us your attempt to solve your current problem as well as describe in greater detail just what is currently tripping you up.

    Much luck.

  3. #3
    mcnam4119 is offline Member
    Join Date
    Sep 2010
    Location
    Singapore
    Posts
    13
    Rep Power
    0

    Default

    I did, its only cus it took me a while to work it out.

  4. #4
    KevinWorkman's Avatar
    KevinWorkman is offline Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    4,039
    Rep Power
    10

    Default

    Your meaningless post title is going to prevent a lot of people from even viewing your thread. Of the few who will actually view the thread, your unformatted code will send most of them packing without reading any further. Of the couple of people who do read your post, saying things like "Plz help I only have 2-3 days to do this." will annoy them enough that they no longer want to help.

  5. #5
    mcnam4119 is offline Member
    Join Date
    Sep 2010
    Location
    Singapore
    Posts
    13
    Rep Power
    0

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
  •