• Post Reply Bookmark Topic Watch Topic
  • New Topic

Passwords, running balance, am i getting ahead of myself?  RSS feed

 
Mike Mo
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is my newest project. As i said in another of my posts im about 2 weeks into programming with no experience at all. i have the program goals at the top, as well as the comments throughout with the problems im coming across.







thanks everyone!
 
Ron McLeod
Bartender
Posts: 1603
232
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I didn't look at the code, but if you are wanting constructive feedback - I find the names for the classes and instances confusing:

  • You have a class called Account, which is actually a user interface and an application driver.
  • You have a class called Bank which is actually something that represents a pair of accounts.
  • You have an instance called user which is actually an instance of an accounts.

  •  
    Mike Mo
    Ranch Hand
    Posts: 40
    • Likes 1
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Ron McLeod wrote:I didn't look at the code, but if you are wanting constructive feedback - I find the names for the classes and instances confusing:

  • You have a class called Account, which is actually a user interface and an application driver.
  • You have a class called Bank which is actually something that represents a pair of accounts.
  • You have an instance called user which is actually an instance of an accounts.




  • i actually just noticed that lol i was so worried about getting the code to compile and output what i wanted that i got the classes backwards :/

    im still learning terms and lingo of the trade. im trying to have a "bank" that... passes out? accounts to people that can then enter a first/last name and eventually when i get that far a password. the account will then keep a running balance when that person/user logs in. this has no purpose really other than for me to get used to how to manipulate the code and use the diff commands. but yes i agree i botched that up haha thank you for pointing that out to me. the "user" would be each persons account when they made it. just not sure how to get the data to be stored. in BlueJ when i make a few new accounts and name them acct1 acct 2 and acct 3 i can input numbers to them and it all checks except the storing the bal for later. maybe that works too and im just more clueless than i thought.

    thanks for the reply
     
    Junilu Lacar
    Sheriff
    Posts: 11494
    180
    Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    I think you're biting off more than what you can chew with your baby programming teeth. Your main method is already way too big. It should only be a few lines, 5 to 10 lines at most, ideally just one or two lines.

    Some of the most important things you'll need to learn about programming aren't about language constructs like classes, objects, methods, fields, loops, etc. Planning, organization, decomposition, and abstraction are just as, if not more important. Learn how to do these with smaller program's first before you try to tackle such a wide range of requirements like this.
     
    Knute Snortum
    Sheriff
    Posts: 4287
    127
    Chrome Eclipse IDE Java Postgres Database VI Editor
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    That's pretty good for two weeks.  Your formatting is good, but your lines are sometimes too long.  80 to 120 characters should be the maximum.

    It's good practice to get out of the habit of putting a lot of code in main().  Your main() should only create an object and launch a "driver" method that starts everything rolling.  See Main is a Pain.

    Your driver method should be a high-level view of what the program does.  In your case, it would start out as something like this:



    Each starred line would be a method, and those methods might call methods, until you get to the actual code that does the work.  Most of this planning you can do on paper (or in a text editor).
     
    Mike Mo
    Ranch Hand
    Posts: 40
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Knute Snortum wrote:That's pretty good for two weeks.  Your formatting is good, but your lines are sometimes too long.  80 to 120 characters should be the maximum.

    It's good practice to get out of the habit of putting a lot of code in main().  Your main() should only create an object and launch a "driver" method that starts everything rolling.  See Main is a Pain.

    Your driver method should be a high-level view of what the program does.  In your case, it would start out as something like this:



    Each starred line would be a method, and those methods might call methods, until you get to the actual code that does the work.  Most of this planning you can do on paper (or in a text editor).



    That link main is a pain... reeeally good haha thank you for that one! good info. im going to try to redo my atm program and work on all of that.
     
    • Post Reply Bookmark Topic Watch Topic
    • New Topic
    Boost this thread!