• 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
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Registration Program

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey there,

I am attempting to create a bank account registration program. I am having trouble with my class though. I only have one additional class, that being Person. Is there a way around create a third class such as Account and adding each new Person to an array in the main class?

Not to sure if this makes sense, i dont really know how to explain it.
 
Marshal
Posts: 74025
332
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why did you post in the Jobs Discussion forum? Are you required to submit this as part of a job application?

As a general rule of thumb, it is quite difficult to create too many classes and quite easy to create too few.
I think you should forget the term “main class”. There is such a thing as a main() method, which is intended for starting an application and as you will see here contains one statement (yes, I can count: one statement), but all other code should be in different classes. You may want a method which tests all the methods of your other classes. I think you will have to go back to your design and write down what you want to do, and you will be able to work out which classes you need. I can't see how you can do it with less than four.
Since you mention arrays, I presume you have not yet learnt about Lists.
 
Konrad Cetes
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I forgot to change the forum when I was writing my question.

You are correct in assuming I haven't learnt about lists. And ya i guess main class is the wrong term. Basically I can only have one class and a main method. But this class is a Person class which contains contractors such as name, DOB and address. What I am trying to do is add a new person to the array in the main method. But i cant. I have already written down some pseudocode to try and resolve the issue but i cant seem to find a fix. Because normally with a registration program there would be a superclass like Student which would extend Person, but i cant have that.
 
Campbell Ritchie
Marshal
Posts: 74025
332
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I presume by contractor you mean constructor. And i would think Person is a superclass of Student, the opposite of what you wrote. What do students have to do with bank accounts? If you are creating a bank application, then students are a red herring. Anyway, you can pass a Student reference wherever a Person reference is required. If you designed the Student class correctly, there will be discernible difference.
I suggest you show us what you have about adding people to your array, and let's see what we think of it.

[Additional}You are now out of the jobs forum.
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic