Results 1 to 11 of 11
Thread: need help urgently new to java
- 07-02-2009, 12:00 PM #1
Member
- Join Date
- Jul 2009
- Posts
- 1
- Rep Power
- 0
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
- 07-02-2009, 12:40 PM #2
Hi,
First write a pseudo code and start working.Put comments properly.
Ur if conditions are not proper.Please check it once.
-Regards
RamyaRamya:cool:
- 07-02-2009, 01:29 PM #3
Member
- Join Date
- Jun 2009
- Posts
- 43
- Rep Power
- 0
why don't u switch case instead its much easier
- 07-02-2009, 01:31 PM #4
Member
- Join Date
- Jun 2009
- Posts
- 43
- Rep Power
- 0
why don't you use switch case instead and its much easier
- 07-02-2009, 02:14 PM #5
Member
- Join Date
- Apr 2009
- Location
- Brisbane
- Posts
- 86
- Rep Power
- 0
> 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.
- 07-02-2009, 02:43 PM #6
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
@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.
- 07-03-2009, 12:46 AM #7
Senior Member
- Join Date
- Sep 2008
- Posts
- 564
- Rep Power
- 5
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.
- 07-03-2009, 01:43 PM #8
Member
- Join Date
- Jul 2009
- Posts
- 1
- Rep Power
- 0
It's an assignment for Programming 1 @ RMIT University (basically first year) I know because I just completed the exact assignment myself.
- 07-03-2009, 03:11 PM #9
Member
- Join Date
- Jul 2009
- Posts
- 4
- Rep Power
- 0
log on questionpapers.net
- 07-03-2009, 08:55 PM #10
USE CODE TAGS--> [CODE]...[/CODE]
Get NotePad++ (free)
- 07-04-2009, 04:47 AM #11
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Seems like that, I've already notify about the risk he has. We'll see ab. :)
Similar Threads
-
help needed urgently
By amarchandar in forum New To JavaReplies: 1Last Post: 03-04-2009, 10:00 AM -
JSP (urgently)
By G.Ajay Kumar in forum JavaServer Pages (JSP) and JSTLReplies: 0Last Post: 02-19-2009, 05:43 AM -
Help!urgently please
By kevN in forum AWT / SwingReplies: 10Last Post: 01-09-2009, 05:37 PM -
Hibernate order by query thru java solution urgently reqd
By altaf in forum JDBCReplies: 0Last Post: 03-12-2008, 02:23 PM -
please help urgently
By ananas7777 in forum New To JavaReplies: 1Last Post: 12-22-2007, 02:48 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks