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
Re: i need a code for this program
Are you asking someone to write it for you?
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);
}
}
}
}
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.
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.
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.
Re: i need a code for this program
OK thank you and sorry.
:)
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.