Results 1 to 11 of 11
  1. #1
    deecaf is offline Member
    Join Date
    Jul 2009
    Posts
    1
    Rep Power
    0

    Default need help urgently new to java

    hey guys im doing a project for work

    i have to make a menu with four options
    A.
    B.
    C.
    X. exit

    now i can type so i can display it how they want it but they want to be able to continually select options until X is typed at the prompt, i figure a while loop is the go but im not sure on how to get it to accecpt the differnt options
    heres wat i have so far

    import java.io.*;
    import java.util.Scanner;
    import java.lang.String;
    import java.io.BufferedReader;
    import java.io.InputStreamReader;

    public class AssignmentOne
    {

    public static void main (String [] args)throws IOException
    {

    System.out.println(new String("***************Assignment 1 menu***************"));
    System.out.println("");
    System.out.println("A. Prime number checker .");
    System.out.println("B. Stamp Duty calculator .");
    System.out.println("C. Vowel counter .");
    System.out.println("X. Exit program .");
    System.out.println("****************************** *****************");
    System.out.println("");


    BufferedReader charInput = new BufferedReader(new InputStreamReader( System.in));
    char choice;

    System.out.println("Please select one of the above menu options :");
    choice = charInput.readLine().charAt(0);


    while (choice != 'X' || choice != 'x')
    {


    System.out.println("Please select one of the above menu options :");
    choice = charInput.readLine().charAt(0);

    if (choice== 'a' || choice== 'A')
    {

    System.out.println("boobies");


    if (choice== 'b' || choice== 'B')
    {

    System.out.println("ass");

    if (choice== 'c' || choice== 'C')
    {
    BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
    System.out.println("Enter the String:");
    String text = bf.readLine();
    int count = 0;

    for (int i = 0; i < text.length(); i++)
    {
    char c = text.charAt(i);
    if (c=='a' || c=='e' || c=='i' || c=='o' || c=='u') {
    count++;
    }


    System.out.println("There are" + " " + count + " " + "vowels");
    }
    }
    }
    }

    System.out.println("Exit");

    }
    }
    }



    can any1 please help
    thanks guys

  2. #2
    RamyaSivakanth's Avatar
    RamyaSivakanth is offline Senior Member
    Join Date
    Apr 2009
    Location
    Chennai
    Posts
    804
    Rep Power
    6

    Default

    Hi,
    First write a pseudo code and start working.Put comments properly.
    Ur if conditions are not proper.Please check it once.

    -Regards
    Ramya
    Ramya:cool:

  3. #3
    kiki2009 is offline Member
    Join Date
    Jun 2009
    Posts
    43
    Rep Power
    0

    Default

    why don't u switch case instead its much easier

  4. #4
    kiki2009 is offline Member
    Join Date
    Jun 2009
    Posts
    43
    Rep Power
    0

    Default

    why don't you use switch case instead and its much easier

  5. #5
    corlettk is offline Member
    Join Date
    Apr 2009
    Location
    Brisbane
    Posts
    86
    Rep Power
    0

    Default

    > hey guys im doing a project for work

    Hmmm... Maybe the best thing you could do is confess to your new boss that you're completely incompetent and that you're very sorry for wasting his time, and money?

    > public class AssignmentOne

    So this is really a homework assignment, isn't it. The only question is: Is it high school or first-year university?

    > System.out.println("boobies");

    High school, for sure.

    Hmmm... So why should I invest my time in helping an inveterate lier? Nope I think I'll find another suplicant.

    And pull your socks up.

    It's been fun. Cheers. Keith.
    Last edited by corlettk; 07-02-2009 at 02:17 PM.

  6. #6
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    @OP: I hope it's clear to you what most of the members are here trying to explain to you. This is forum, not a place to get your homework done and so on. Show up your spirit and ask you questions more clearly.

    Personally I really don't like your title. We are really like to help you, but not in this way lol. Ask your question more specifically. Then we can help you a lot, more than this.

  7. #7
    emceenugget is offline Senior Member
    Join Date
    Sep 2008
    Posts
    564
    Rep Power
    6

    Default

    while i mull over the confusion as to whether you need help urgently or are urgently new to java, i'd like to add that i hope no job of yours is requiring you to create a program with four completely unrelated and impractical functions, the most useful being to exit the program...

    anyways, just looking at the placement of your curly bracers, i can say that you should review your own code better and step through it yourself before asking for help.

  8. #8
    ravencd is offline Member
    Join Date
    Jul 2009
    Posts
    1
    Rep Power
    0

    Default

    It's an assignment for Programming 1 @ RMIT University (basically first year) I know because I just completed the exact assignment myself.

  9. #9
    Join Date
    Jul 2009
    Posts
    4
    Rep Power
    0

    Default

    log on questionpapers.net

  10. #10
    angryboy's Avatar
    angryboy is offline Senior Member
    Join Date
    Jan 2009
    Posts
    742
    Rep Power
    6

    Default

    Quote Originally Posted by rameshperumal1984 View Post
    log on questionpapers.net
    are you advertising?
    USE CODE TAGS--> [CODE]...[/CODE]
    Get NotePad++ (free)

  11. #11
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

Similar Threads

  1. help needed urgently
    By amarchandar in forum New To Java
    Replies: 1
    Last Post: 03-04-2009, 10:00 AM
  2. JSP (urgently)
    By G.Ajay Kumar in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 02-19-2009, 05:43 AM
  3. Help!urgently please
    By kevN in forum AWT / Swing
    Replies: 10
    Last Post: 01-09-2009, 05:37 PM
  4. Replies: 0
    Last Post: 03-12-2008, 02:23 PM
  5. please help urgently
    By ananas7777 in forum New To Java
    Replies: 1
    Last Post: 12-22-2007, 02:48 AM

Posting Permissions

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