• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

need help with my assessment

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?

 
Bartender
Posts: 1558
5
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
cha wan
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have changed some error, can you tell me how to solve this problem? thanks
 
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i am trying to write down on paper, but has no idea what to do now.
 
Campbell Ritchie
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic