Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Need Help with these Methods  RSS feed

 
Wayne Williamson
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am having a difficult time approaching this program. I have most of the code written and if you run it, it looks how it is supposed to look. It has to be written in multiply classes, after the if section for the JRadioButtons I am lost on how to approach the methods and other classes. I've went to programming tutors and used other resources and they were not helpful at all( they were not very knowledgeable) I don't want it done for me I just don't know what to do next. When you enter an amount with the deposit button selected and hit enter it should send it to Balance TextField and status textfield should say "OK", then if you click withdraw button and type an amount more than whats in the balance it will display a status of "Over Drawn". After the JRadiobutton IF section I was just guessing in what to do.

Areas of Concentration:

 Writing classes
 Constructors

Assignment:

 Create the BankAccount.java program.

The user enters the amount of deposit. If an integer is not entered, a message (JOptionPane) displays. Then the Enter button is clicked and the Balance and Status is displayed.
If the user makes a Withdraw that is more than the current Balance, the Status displays an OVER DRAWN.
NOTE: When coding for decimals use double instead of float!
Specifications:

 All variable names use two or more words naming convention
 Methods and method class MUST use two or more words naming convention
 The try-catch block must be used
 Method calls and methods MUST be used
 There MUST be an object classes
 Output MUST be formatted for currency
 Window size is 400 x 400


 
Campbell Ritchie
Marshal
Posts: 55722
163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Start with the easy bits.

Create a bank account class. This must not extend a GUI class. Give it the appropriate methods. Run it again and again from the command line/terminal until you are sure it is working.
Remind yourself what the naming conventions are. Two word convention probably does not mean that all variable names consist of two words. It probably means that you have to use a particular type of spelling if a name comprises two words.
Your button code looks very repetitive. You should probably create yourself a button factory class with (static) methods which return buttons.
 
Wayne Williamson
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm sorry, still confused isn't my main class BankAccount already, whats the GUI class, and whats the command line
 
Campbell Ritchie
Marshal
Posts: 55722
163
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It should start with class BankAccount but there should be no extends JFrame. You might have extends Account, but not a GUI Component. The GUI classes are there for display. For holding the data you should have different classes.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!