aspose file tools*
The moose likes Beginning Java and the fly likes need help with my assessment Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "need help with my assessment" Watch "need help with my assessment" New topic
Author

need help with my assessment

cha wan
Greenhorn

Joined: Mar 17, 2012
Posts: 3
Creat a password.
(a) ask the user to enter their name in the fomat: first middle last where the first, middle and last names are separated by a single space. store this as a string.

(b)ask user for their birthday. The birthday be given in the form mmddyyy where mm is the month,dd is the day of the month and yyyy is the year. if the day or month is 9 or less, a zero should still be entered by user for the first digit. For example,December 15, 1982 would be entered as 12151982. Store this in a string variable.

(c) the password be formed by picking a random letter from the first name,a random letter from the middle name, a random letter from the last name, and three random digits from the birthday.

(d) print out the password after creating it.

i have a difficulty to do (c) in this question or how to think about?

Anayonkar Shivalkar
Bartender

Joined: Dec 08, 2010
Posts: 1509
    
    5

Hi cha wan,

Welcome to CodeRanch!

Before approaching the problem, I would suggest few things:
1) Please UseCodeTags. You can still edit the original post with it. Also, please post the working code. Working as in code which user can directly copy-paste, compile and debug on their machines. This will help the people who are looking into your issue. Currently, your code doesn't even have closing braces (and I doubt if this is complete code or not).
2) Please TellTheDetails. You said that
cha wan wrote:i have problem to continue .....
What does this mean? Is it that there is compilation error? or runtime exception? or some logical error?
3) Please bear in mind that this is NotACodeMill. It is absolutely fine to ask help(not ready-made code) on assignments etc., but before that, we would appreciate if you also let us know your line of thinking, and what have you done till yet, and what exactly are you finding difficult/confusing.

Next to these, I found some serious flaws in the code you have posted. If you are not aware of object oriented concepts, and/or programming in general, then firstly I would suggest to go through a descent book. Also, if you are not a habitual programmer (in terms of logic), then take a paper and pencil, and make sure you've understood/written down every step of logic before even starting of coding.

I don't at all meant to be harsh, and don't worry, these things happen to the first time programmer. But more time you put in the basics now (algorithm, oo concepts, debugging on paper etc.), less problems it will create in the future.

I hope this helps.


Regards,
Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)
cha wan
Greenhorn

Joined: Mar 17, 2012
Posts: 3
i have changed some error, can you tell me how to solve this problem? thanks
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39436
    
  28
I suggest you stop trying to program it, and write down on paper how you would do it manually. Repeat the process until you have it written really simply. Then you can easily convert that to code.
cha wan
Greenhorn

Joined: Mar 17, 2012
Posts: 3
i am trying to write down on paper, but has no idea what to do now.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39436
    
  28
Write
Cha Wan Ritchie
and draw lines showing how you might incorporate one of those names in the password. Get that working. Then show how you can choose one letter. Do it bit by bit.
I presume that is an American exercise, since not everybody in this country (UK) actually has a middle name.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: need help with my assessment