PLEASE HELP - JUST SOME GUIDANCE I AM STUCK!!!!!!!!

Hi, I was wondering if anyone can help me, I am very new to Java, and I am trying to create piece of program that acts like a bank account. So far I have this bit working but I need to add some sort of interaction menu, i.e. if you look below it displays the information from two accounts, one Gao and one Johns. I want it so that before it displays this to ask the user for the account number and then display the correct account. I hope this makes sense. I have tried all day to add some sort of interaction menu here, but no luck. All I am asking is for some advice on how I could possibly achieve this, and where would I put the menu code. I am really really stuck and this is giving me a headache! Please help!
// The code starts here
class BankAccount
     String name;
     String AcNo;
     double deposit;
     BankAccount() {}
     BankAccount(String aName, String aAcNo, double aDep)
          name = aName;
          AcNo = aAcNo;
          deposit = aDep;
     public void setName(String aName)
          name=aName;
     public void setAcNo(String aAcNo)
          AcNo = aAcNo;
     public void setDeposit(double aDep)
          deposit = aDep;
     public String getName()
          return name;
     public String getAcNo()
          return AcNo;
     public double getDeposit()
          return deposit;
     public double withDrawCash(double cash)
          if (cash <=deposit)
               deposit = deposit-cash;
               return(cash);
          else
          System.out.println("Not enough money in your account!");
          return (0);
class demo
     public static void main(String args[])
          BankAccount myBankAc = new BankAccount("Gao", "12-23-34", 1000);
          BankAccount JohnBankAc = new BankAccount("John", "34-56-90", 200000);
          myBankAc.withDrawCash(500);
          System.out.println("MY balance is : " + myBankAc.getDeposit());
          System.out.println("MY name is : " + myBankAc.getName());
          System.out.println("MY AcNo is : " + myBankAc.getAcNo());
          JohnBankAc.withDrawCash(2000);
          double balance = JohnBankAc.getDeposit();
          System.out.println("John's balance is : " + balance);
}

a few suggestions:
(1) Either put the menu code in the main() method of your bank account or put it in a separate class and instantiate an instance of that class in main().
(2) If you want to input an owner name or account number and then have the main method print the correct account you'll want to write a toString() method for your BankAccount class that will let you print out the name, account number, and current balance. Then you'll want to add a bunch of BankAccounts to a data structure like a java.util.Map where the key is the owner name or account number (whichever one you want to do the search on) and the value is the BankAccount object.
(3) Better to externalize the data you want to do the search on into a text file rather than hard-coding all the BankAccount info in your main class.
If you could figure out how to write a new BankAccount to this file it'd be pretty neat, because then you'd have all the ingredients for a simple, flat file-based database: it would read existing accounts, let you search for an individual account, update balances by making deposits/withdrawals, and insert new accounts.
If I were your professor, and you managed this feat, I'd give you an A.
%

Similar Messages

  • Please help. just got my jabra halo, worked fine with my iphone4 but can't use it on my macbook pro. it always prompts " the devise does not have the necessary service

    please help. just got my jabra halo, worked fine with my iphone4 but can't use it on my macbook pro. it always prompts " the devise does not have the necessary service

    Found these instructions here:
    https://discussions.apple.com/message/15388885#15388885
    I found an answer that worked for me. I am using an iMac.
    (1) Sign out of the iTunes store
    (2) Open a NEW account with a new Apple ID
    (3) Go through the sign up process and then go to the ACCOUNT INFORMATION page
    (4) Go to RECOMENDATIONS & PING POSTING
    (5) Turn on Genius there
    Once the Genius updates, you can sign out and then sign in under your original Apple ID or the e-mail address you use for the iTunes store. All my store credit was there and now Genius worked.
    Rather odd but I actually like the Genius at times except when it can't deal with some of my lesser known bands that I listen to.
    Worked for me.

  • I am unable to set up my iphone 5 after reset since am getting a error stating 'unable to reach server' . i tried restoring the same from my computer  but  i get a error stating server unavailable' .  please help me as my phone is stuck at the set up page

    i am unable to set up my iphone 5 after reset since am getting a error stating 'unable to reach server' . i tried restoring the same from my computer  but  i get a error stating server unavailable' .  please help me as my phone is stuck at the set up page. so i have already tried recovery mode as well.

    Contact Apple support for warranty service.

  • I want to change my apple id password but I forgot the security questions please help me some using my icloud I'd

    I want to change my apple id password but I forgot the security questions please help me some using my icloud I'd and if confirmation is must so please phone number is mine please send a code please help me my apple

    Welcome to the Apple community.
    If you are unable to remember your password, security questions, don’t have access to your rescue address or are unable to reset your password for whatever reason, your only option is to contact AppleCare, upon speaking to an operator you should explain that your problem is related to your Apple ID, this way you will not be charged for assistance, even if you don’t have an AppleCare plan.
    The operator will take you through some steps you may have already tried, however they need to be sure they have exhausted all usual approaches before trying to reset your account, so you should try to be helpful and show patience with the procedure.
    The operator will need to verify they are speaking to the account holder and may ask you some questions that only the account holder could know, and you will need to answer them if the process is to proceed.
    Once the operator has verified your identity they will send a message through to your device which contains an alpha numeric code, which you will need to read back to them.
    Once this has been completed they will send an email to your iCloud email address after a period of 24 hours, so you should check that mail is enabled in your devices iCloud settings.
    Upon receipt of the email, use the reset link provided to reset your password, after which you should be able to make the adjustments to iCloud that you wish to do.

  • Please help, just recently got ios7 on my phone and have updated itunes but my iphone 4s wont sync i have tried everything like turning restrictions on and things, thank you for reading and please help

    please help, just got iso7 and the new itunes and have synced my ipone once already all fine but suddenly it doesnt work i have tried everything like turning restrictions on and off , please help

    fighter19lisa wrote:
    that only makes it say its synced, when its not.
    No, it does not.  It transfers purchases from the iDevice to the computer.  The computer must be authorized for the Apple ID that the content was acquired with.
    fighter19lisa wrote:
    my playlists wont show up on the phone.
    Are they selected to sync?  Is Manually Manage content on the device selected?
    fighter19lisa wrote:
    i had to change my password for my aol account again and i still cannot get my email on my phone to even work
    What does that have to do with syncing content to the device?  FYI, nothing.

  • Want a complete migration guide to upgrade 11.1.0.7 to 11.2.0.3 database using DBUA..We are implementing R12.1.3 version and then have to migrate the default 11gR1 database to 11.2.0.3 version. Please help with some step by step docs

    Want a complete migration guide to upgrade 11.1.0.7 to 11.2.0.3 database using DBUA..We are implementing R12.1.3 version and then have to migrate the default 11gR1 database to 11.2.0.3 version. Please help with some step by step docs

    Upgrade to 11.2.0.3 -- Interoperability Notes Oracle EBS R12 with Oracle Database 11gR2 (11.2.0.3) (Doc ID 1585578.1)
    Upgrade to 11.2.0.4 (latest 11gR2 patchset certified with R12) -- Interoperability Notes EBS 12.0 and 12.1 with Database 11gR2 (Doc ID 1058763.1)
    Thanks,
    Hussein

  • HT201301 I recorded my friend singing a song, using Audio Memos app... I can't figure out how to burn it to a CD though?? Please HELP!! I've been stuck on this for a week now!!

    I recorded my friend singing a song, using Audio Memos app... I can't figure out how to burn it to a CD though?? Please HELP!! I've been stuck on this for a week now!!

    Did you try emailing the voice memo to yourself and then using a CD burning app on your computer?

  • TS5376 I am hopeless, my computer will not uninstall itunes so i can reinstall! i really truly do need help! can someone please give me some guidance? i have tried almost everything and it is still not working!

    I really need help!!! my itunes 11.1.4 download really screwed my computer up! I have tried everything i can search for and i still cant uninstall itunes in order to reinstall. If anyone could please help me it would be muchhhhhhhhh appreaciated. Thanks!

    Carly,
    I went through the same thing. Searched again for another error I was seeing and found this help from Delgadoh and this finally fixed me! He mentioned this article: iTunes 11.1.4 for Windows: Unable to install or open http://support.apple.com/kb/TS5376.  But I had not read it.  I went straight to his instructions below.
    If you haven't already tried these steps:
    Use the Control Panel to uninstall iTunes and related software components in the following order and then restart your computer.
    iTunes
    Apple Software Update
    Apple Mobile Device Support
    Bonjour
    Apple Application Support (iTunes 9 or later)
    Important: Uninstalling these components in a different order, or only uninstalling some of these components may have unintended affects. 

  • PLEASE HELP: Need some help with coding a next page button.

    so ok, in details, I'm trying to code a next page button and can't really figure out how and tried to look for them over the net but can't find the kind I am looking for. So ok, the kind of next page button I'm looking for is the kind where you have like << 1 2 3 4 5 ... (Next page button) >> not just a button where I need to hyperlink it to the next page url cuz I have like 35 pages to put... so I'm trying to figure it out yet no cigar so can someone please help me with this? Thanks!

    What I've seen done a lot (on forums with upwards of 1000 pages on some threads) is to add a "pagination" block of code that has:
    two or three pages before the current page
    two or three pages after the current page
    a drop down with ALL pages listed
    The "next" link or button is then just a copy  of the final link in the inline list.
    Something like this:
    <table>
    <tr>
    <td align="right" valign="bottom" nowrap="nowrap"><span class="gensmall"><b>Goto page <select name="generate_pagination" onchange="if(this.options[this.selectedIndex].value != -1){ window.location = this.options[this.selectedIndex].value; }"><option value="forum-page-26.html" selected="selected">1</option><option value="forum-page-26-45.html">2</option><option value="forum-page-26-90.html">3</option><option value="forum-page-26-135.html">4</option><option value="forum-page-26-180.html">5</option><option value="forum-page-26-225.html">6</option><option value="forum-page-26-270.html">7</option><option value="forum-page-26-315.html">8</option><option value="forum-page-26-360.html">9</option><option value="forum-page-26-405.html">10</option><option value="forum-page-26-450.html">11</option><option value="forum-page-26-495.html">12</option><option value="forum-page-26-540.html">13</option><option value="forum-page-26-585.html">14</option><option value="forum-page-26-630.html">15</option><option value="forum-page-26-675.html">16</option><option value="forum-page-26-720.html">17</option><option value="forum-page-26-765.html">18</option><option value="forum-page-26-810.html">19</option><option value="forum-page-26-855.html">20</option><option value="forum-page-26-900.html">21</option><option value="forum-page-26-945.html">22</option><option value="forum-page-26-990.html">23</option><option value="forum-page-26-1035.html">24</option><option value="forum-page-26-1080.html">25</option><option value="forum-page-26-1125.html">26</option><option value="forum-page-26-1170.html">27</option><option value="forum-page-26-1215.html">28</option><option value="forum-page-26-1260.html">29</option><option value="forum-page-26-1305.html">30</option><option value="forum-page-26-1350.html">31</option><option value="forum-page-26-1395.html">32</option><option value="forum-page-26-1440.html">33</option><option value="forum-page-26-1485.html">34</option><option value="forum-page-26-1530.html">35</option><option value="forum-page-26-1575.html">36</option><option value="forum-page-26-1620.html">37</option><option value="forum-page-26-1665.html">38</option><option value="forum-page-26-1710.html">39</option><option value="forum-page-26-1755.html">40</option><option value="forum-page-26-1800.html">41</option><option value="forum-page-26-1845.html">42</option><option value="forum-page-26-1890.html">43</option><option value="forum-page-26-1935.html">44</option><option value="forum-page-26-1980.html">45</option><option value="forum-page-26-2025.html">46</option><option value="forum-page-26-2070.html">47</option><option value="forum-page-26-2115.html">48</option><option value="forum-page-26-2160.html">49</option><option value="forum-page-26-2205.html">50</option></select>  <b>1</b>, <a href="forum-page-26-45.html">2</a>, <a href="forum-page-26-90.html">3</a> ... <a href="forum-page-26-2250.html">51</a>, <a href="forum-page-26-2295.html">52</a>, <a href="forum-page-26-2340.html">53</a>  <a href="forum-page-26-45.html">Next</a></b></span></td>
    </tr>
    </table>

  • PLEASE HELP!!! power button stuck and wont turn on!

    So I've had my iphone4s for a little bit over a year and before the power button got stuck, I had problems with it turning off sometimes during school and it wouldn't turn back on without a hard reset. Then afterschool one day I could no longer hard reset it and it wouldn't turn on! Then after a few days of examining it i reazlized that the power button is jammed inside, but i could still wiggle it. I tried charging in against the wall, plugging it into the computer and nothing worked; itunes didn't even recognize it anymore! So I brought it to the Apple store to have them look at it, and they said that they couldn't turn it back on and its not possible to just replace the power button ALSO my warranty is up and therefore they can't replace it for me...and I'd have to pay the full price of a new iphone if I want to replace it...
    Is anyone else experiencing this problem? Have you found a solution besides replacing it? I really don't want to purchase another...please help! ):

    Try rebooting it by holding the Lock button and the Home button at the same time for about 10 seconds until the Apple logo shows up on the screen.
    This usually works when your device is frozen

  • I was using my apple tv remote but its not working. I tried everything selected different input unplugging the apple tv but still no signal. I can't update bec its blank what am i going to do Please help just purchased this item maybe 3-4 mos ago

    Can someone please help me Apple tv is not working.  There is no signal, i trIed pressing the left and right button and used different hdmi input unplugged the device still not working.  I just purchased it maybe 3-4 months ago

    You might want to try asking in the correct forum. This forum is for iPhones being used in an enterprise environment.

  • Please help with some query

    hello all!
    please, help me again.
    we have a foreign key discrepancy and my task is to create a view which will show the 3 aspects.
    Let's we have 3 schemas: A - good (which means that i will compare WITH A, source)
    B and C are bad (which mean that I will checking this schemas).
    So, i need to obtain:
    1) FK that DO NOT exist in B&C and do exist in A
    2) FK that DO exist in bad schemas (B&C) but DO NOT exist in good schema (A)
    3) FK's that exist in both (A&B, A&C) schemas on the SAME TABLE, have THE SAME CONSTRAINT_NAME but are on the DIFFERENT columns.
    the first and second I seem to be done through the
    select CONSTRAINT_NAME, TABLE_NAME, STATUS from dba_constraints where owner='PRIV_MD' and CONSTRAINT_TYPE='R' and CONSTRAINT_NAME
    2 NOT IN (select CONSTRAINT_NAME from dba_constraints where owner ='MSA_MD'); (to get the second task we just reversing owners in query and subquery)
    query. but the third one is really pain in my back. i have a query:
    SELECT a.column_name, b.column_name FROM dba_cons_columns a, dba_cons_columns b, dba_constraints c, dba_constraints d
    WHERE c.CONSTRAINT_TYPE='R'
    AND a.CONSTRAINT_NAME = b.CONSTRAINT_NAME
    AND a.CONSTRAINT_NAME = c.CONSTRAINT_NAME
    AND b.CONSTRAINT_NAME = d.CONSTRAINT_NAME
    AND a.owner = 'PRIV_MD' AND b.owner = 'MSA_MD';
    which runs hours and returns million of rows with the two columns with the same names... but if i'm adding
    AND a.column_name != a.column_name (i'm not sure it's a correct syntax)
    line it returns "no rows selected"
    please, help me obtain it, i'm fighting already the second day..
    (please, don't be angry, i'm just learning and this is my first task on my work...)

    This is basically just a UNION ALL (the constraint columns from both schemas)
    MINUS what exists in both (the INTERSECTion)
    I made it a little more complicated so you could see in which schema the column is used. You could use exactly the same approach for your questions 1 and 2 also.
    SELECT * FROM
    (SELECT a.column_name,c.constraint_name,'salive' schema_containing
    FROM dba_cons_columns a
    INNER JOIN dba_constraints c ON a.CONSTRAINT_NAME = c.CONSTRAINT_NAME
    WHERE a.owner = 'SALIVE' and c.constraint_type = 'R'
    UNION ALL
    select b.column_name,d.constraint_name,'satest'
    FROM dba_cons_columns b
    INNER JOIN dba_constraints d ON b.CONSTRAINT_NAME = d.CONSTRAINT_NAME
    WHERE d.CONSTRAINT_TYPE='R' AND b.owner = 'SATEST') u
    WHERE NOT EXISTS
    (SELECT *
    FROM
    (SELECT a.column_name,c.constraint_name
    FROM dba_cons_columns a
    INNER JOIN dba_constraints c ON a.CONSTRAINT_NAME = c.CONSTRAINT_NAME
    WHERE a.owner = 'SALIVE' and c.constraint_type = 'R'
    INTERSECT
    select b.column_name,d.constraint_name
    FROM dba_cons_columns b
    INNER JOIN dba_constraints d ON b.CONSTRAINT_NAME = d.CONSTRAINT_NAME
    WHERE d.CONSTRAINT_TYPE='R' AND b.owner = 'SATEST') i
    WHERE u.column_name = i.column_name and u.constraint_name = i.constraint_name)

  • Please Help! Ipod Touch Gen 5 stuck in restoring mode.

    I purchased a Ipod Touch Gen 5 32gb for christmas and i just brought new songs from itunes and i plugged my ipod in to update the songs, itunes came up with a message saying "itunes has detected ipod in restoring mode, you need to restore ipod before you can use itunes." So i clicked restore and after 40 min it said completed but again the message came up. After restoring it about 5 times, nothing changed. I disconnected my ipod from my pc and it just has the image of the itunes symbol and the usb cord. I have the lastest itunes verson. Ive tried everything but nothings worked and i dont want to jailbreak it. Please help!

    Try:
    - iOS: Not responding or does not turn on
    - Also try DFU mode after try recovery mode
    How to put iPod touch / iPhone into DFU mode « Karthik's scribblings
    - If not successful and you can't fully turn the iOS device fully off, let the battery fully drain. After charging for an least an hour try the above again.
    - If still not successful that usually indicates a hardware problem and an appointment at the Genius Bar of an Apple store is in order.
    Apple Retail Store - Genius Bar       

  • Please help with some basic javascript syntax

    Can anyone please help me with a "remove from favourites"
    facility i'm working on.
    I query to get all the favouites, then i output those
    favourites down the page
    each favourite has a "remove from favourites" link - i want
    to make it so when a user clicks this link they get a javascript
    confirm box pop up saying "are you sure you want to remove
    #favourites name# from your favourites?"
    so i have..
    function remove(profile,name) {
    if (confirm("Are you sure you want to remove #name# from
    your favourites?")) {
    window.location =
    "remove_from_favourites.cfm?deleteFavID=#profile#&removedName=#name#"
    and
    <div
    onClick="remove(#rs_favs.favouriteeID#,#rs_favs.firstName#)"
    >Remove from favourites</div>
    but it doesn't work - i think there are 2 problems..
    problem 1 - i have used the CF # in the remove function as i
    don't know what one does in javascript to "output" a variable (see
    where it says "Are you sure you want to remove #name# from your
    favourites") what should i use in place of the "#"?
    problem 2 - i have tried to pass to variables to the function
    >>
    onClick="remove(#rs_favs.favouriteeID#,#rs_favs.firstName#)" and i
    have separated them but a commer "," but i suspect that is
    incorrect syntax
    if anyone could please help me i'd be very grateful as, to be
    honest, i love coldfusion - but javascript just hurts my head! :(
    thanks very much indeed.
    PS the way i've wrapped my "remove from favourites" text in a
    div rather than making it an actual "a href" link - is that right
    or is there a better way (ideally i'd like the text to look like
    all my other links (ie they underline on mouse over)

    You can simply add CSS commands to define your div to look
    like your links.
    div#FavLink
    color: blue;
    text-decoration: underline;
    cursor: pointer;
    <div id="FavLink"
    onClick="remove(#rs_favs.favouriteeID#,'#rs_favs.firstName#')"
    Remove
    from favourites</div>
    That should get you started.
    happysailingdude wrote:
    > thanks CFDEBUG that sorted it - thanks very much
    >
    > just one last thing - more of a CSS issue i think but
    maybe not.
    >
    > so now I have <div
    >
    onClick="remove(#rs_favs.favouriteeID#,'#rs_favs.firstName#')"
    >Remove from
    > favourites</div>
    >
    > which of course isnt a link so it just looks like my
    standard text (as if i'd
    > done <p>Remove from favourites</p>
    >
    > how do i make the "Remove from favourites" text look
    like a link as if i'd
    > done <a href="remove_from_favourites.cfm?....."
    >Remove from favourites</a>
    >
    > i think ive seen links that when you hover over them it
    says "javascript:void"
    > or something at the bottom of the browser - is this the
    answer and if so what
    > is the correct syntax please? or do i need to do
    something with my CSS file?
    >
    > thanks very much indeed for any further help anyone can
    give me to get this
    > page finshed off - thank you
    >

  • HT4910 My iPad says iCloud backup, this ipad has not been backed up in 2wks, Backups happen when this iPad is plugged in, locked, and connected to WiFi. Then a bar with Ok in it! It won't let me restart, or turn off or anything. Please Help, just got it H

    My iPad says
    iCloud Backup
    This iPad hasn't been backed up in 2 wks, Backups happen when this iPad is plugged in, locked, and connected to WiFi
    Then it has a bar with OK in it. I try to click on it, and it does nothing, I try to turn it off it does nothing. PLEASE HELP! I JUST GOT THIS IPAD AND HAVEN'T BEEN ABLE TO USE IT. I don't even remember how it got into what it is in.

    Try this.
    Reset the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider if it appears on the screen - let go of the buttons. Let the iPad start up.

Maybe you are looking for

  • Migrating from exc 2010/hosting to a new exc 2013 forest - GAL (global address list) search

    Hi gyus, I am in the middle of a migration from a different exc 2007 forest and exc 2010/hosting to a new exc 2013 forest. All settings are good and I've been migrating some accounts. The only thing that made me sad is about the GAL. Is it possible f

  • Changing File path for different TIFF files in a For loop

    Hi dear users: I am using "IMAQ write TIFF File.vi" that basically writes a TIFF file to a specified file path. However, I would like to CHANGE the file path for each TIFF file i save in a for loop. The reason for this is that the File path has to in

  • Password policy not allowing to reconfigure STMS

    Hi Guru's, I have done system copy by database restore method, in post activities I have mistakenly deleted STMS configuration on domain controller, now when I am trying to add production server in landscape. the password policy is not allowing us to

  • What does the Low-Pass filter do (for dummies)

    Dear colleagues, I'm about to encode a lot of content for DVD using Apple Compressor Vers 3.5.2. This project calls for 2.0 Stereo as well as 5.1 surround. I am wondering if I should check or un-check the Low-Pass Filter for the Full Bandwidth Channe

  • Connecting the triton 5.1 headset to an iMac

    Hi everyone ! Did you guys have any experience of connecting the triton axpro+ true 5.1 headset to a macbook or an iMac? I found out that iMac has combined analog/digital optical audio out, so i guess it will be fine to connect this headset to an iMa