-
October 9th, 2012, 04:11 AM
#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
-
October 9th, 2012, 12:13 PM
#2
Re: i need a code for this program
Are you asking someone to write it for you?
-
November 8th, 2012, 11:01 AM
#3
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);
}
}
}
}
-
November 8th, 2012, 05:08 PM
#4
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.
-
November 8th, 2012, 05:11 PM
#5
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.
-
November 8th, 2012, 05:42 PM
#6
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.
-
November 8th, 2012, 05:47 PM
#7
Re: i need a code for this program
OK thank you and sorry.
-
November 8th, 2012, 06:35 PM
#8
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 Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|