i need a code for this program
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 8 of 8

Thread: i need a code for this program

Hybrid View

  1. #1
    Join Date
    Oct 2012
    Posts
    1

    i need a code for this program

    Enter Name:
    Category:
    [A]Politics
    [B]Foods
    [C]Religion

    Select Letter:

    DO you want to continue?
    Yes
    No

    I Need a Code that will help me run this program..

    When i choose letter a which is politics there will be a output of a 3paragraph about politics and so on, if i want to continue i can again choose another letter and the same output will appear and if i choose not to continue it will exit the program.. please help

  2. #2
    Join Date
    May 2006
    Location
    UK
    Posts
    4,474

    Re: i need a code for this program

    Are you asking someone to write it for you?
    Posting code? Use code tags like this: [code]...Your code here...[/code]
    Click here for examples of Java Code

  3. #3
    Join Date
    Nov 2012
    Posts
    6

    Re: i need a code for this program

    something like this?

    Code:
    import java.io.Console;
    public class Something {
      public static void main(String[] args) {
        Console console = System.console();
        String name = console.readLine("Enter name: ");
        while(true){ 
          System.out.println("Category:\n[A]Politics\n[B]Foods\n[C]Religion\n\n");
          String sLetter = console.readLine("Select Letter: ");
          char[] cLetter = sLetter.toCharArray();
          switch(cLetter[0]){
            case 'a': 
            //put here the "output"
            System.out.println("a chosen");
            break;
            case 'b': 
            //put here the "output"
            System.out.println("b chosen");
            break;
            //put here the "output"
            case 'c': 
            System.out.println("c chosen");
          }
          String exit = console.readLine("Do you want to continue?\n");
          if(exit.equals("No")){
            System.exit(0);
          }
        }
      }
    }

  4. #4
    Join Date
    May 2006
    Location
    UK
    Posts
    4,474

    Re: i need a code for this program

    Please don't post the answer to someone's homework question, it doesn't help them learn to program and this forum does not condone cheating.
    Posting code? Use code tags like this: [code]...Your code here...[/code]
    Click here for examples of Java Code

  5. #5
    Join Date
    Nov 2012
    Posts
    6

    Re: i need a code for this program

    Sorry, but I assumed that he doesn't want to learn it, but rather just want the code.

  6. #6
    Join Date
    May 2006
    Location
    UK
    Posts
    4,474

    Re: i need a code for this program

    Welcome to the forum.

    I'm sure you are right, but just because the OP is too lazy to do their own homework it doesn't mean you should do it for them.
    Posting code? Use code tags like this: [code]...Your code here...[/code]
    Click here for examples of Java Code

  7. #7
    Join Date
    Nov 2012
    Posts
    6

    Re: i need a code for this program

    OK thank you and sorry.

  8. #8
    Join Date
    May 2006
    Location
    UK
    Posts
    4,474

    Re: i need a code for this program

    No problem, but please feel free to give advice to help people to do their homework.
    We try to help people to solve their homework issues for themselves rather than providing the code.
    Posting code? Use code tags like this: [code]...Your code here...[/code]
    Click here for examples of Java Code

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center