Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

how do i check if there are another same elements and how do i control the scan of 5capital letters and 3 digits in a row?

4 views
Skip to first unread message

xristina4eve

unread,
Apr 8, 2012, 4:14:46 AM4/8/12
to
Hello, I am completely new in java programming and i would like some
help with an issue.

I must create a java program which accepts as an input the account
details of a client. the problem is that the client's code is
consisted by 3 capital letters and 5 digits. how can i do that as i
have to check if the user is typing the code with the right way?
also , later i will have to create another program connected with the
first one which checks if there are another same codes, so as every
client has his own unique code.

Thank you in advance for helping me, this is really hard for me!!!

markspace

unread,
Apr 8, 2012, 12:30:05 PM4/8/12
to
On 4/8/2012 1:14 AM, xristina4eve wrote:
> Hello, I am completely new in java programming and i would like some
> help with an issue.
>
> I must create a java program which accepts as an input the account
> details of a client. the problem is that the client's code is
> consisted by 3 capital letters and 5 digits. how can i do that as i
> have to check if the user is typing the code with the right way?


Use the methods provided by the Character class:

public static void main(String[] args) throws IOException {
int ch = System.in.read();
System.out.println( "Is upper case: " + Character.isUpperCase( ch ));
System.out.println( "Is digit: " + Character.isDigit( ch ));
}

I'm deliberately not showing you more ideas because this is the sort of
issue you should be talking to your instructor about, or his or her TA,
or the lab assistants. It's important for your instructor to get
feedback on where their students are at and what parts of the lecture
they are retaining. If parts of the coursework aren't being presented
(e.g., methods in the Character class), the your instructor needs to be
aware of that also.

Roedy Green

unread,
Apr 8, 2012, 7:59:14 PM4/8/12
to
On Sun, 8 Apr 2012 01:14:46 -0700 (PDT), xristina4eve
<dou...@hotmail.com> wrote, quoted or indirectly quoted someone who
said :

>
>I must create a java program which accepts as an input the account
>details of a client. the problem is that the client's code is
>consisted by 3 capital letters and 5 digits. how can i do that as i
>have to check if the user is typing the code with the right way?
>also , later i will have to create another program connected with the
>first one which checks if there are another same codes, so as every
>client has his own unique code.

You might find the method ST.isLegal useful.
See http://mindprod.com/products1.html#COMMON11
--
Roedy Green Canadian Mind Products
http://mindprod.com
When you were a child, if you did your own experiment
to see if it was better to put to cocoa into your cup first
or the hot milk first, then you likely have the programmer gene..
0 new messages