• 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
  • Paul Clapham
  • Ron McLeod
  • paul wheaton
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • Mikalai Zaikin
  • Himai Minh

Need Help with this basic bank account

 
Ranch Hand
Posts: 123
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ONLY one customers and account
Use the following function to produce the menu:
At the end, when th user quits, the program prints the contents of the account, if it hasn't been deleted. once the user has entered a selection, one of the following functions should be called to perform the specific transaction:
withdrawals: Prompt the user to for his account number and prints an error if he enter it incorrectly. It then ask the user for the amount of the withdrawal. if the account do no contain fund it print an error message.
Deposit: this function prompts the user for the account number. if the account is incorrect, it prints an error message. otherwise, it asks the user for the amount of the deposit.
Deleting: this function prompts the user for the account number. If the account is incorrect, it prints an error message. Otherwise, it delete the account.
balance: this function prompts the user for the account number. If the account is incorrect, it prints an error message. otherwise print the account balance.
Here my program so far:

now my problem is filling out the algorithm of delete and balance. At the same time prompt the user to enter the write account and balance but somehow the program can bypass the account if use the right amount on balance or account with different balance.
 
Marshal
Posts: 72612
317
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Where is your account class?
 
jin Otanashi
Ranch Hand
Posts: 123
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:Where is your account class?


there is not account class yet, really is just one personal account (main), if there is a multiple account then i will need the account class. The program work fine but I don't how to delete and show the account numbers' balance, this C++ program work is in progress, meaning some minor mistake with the algorithm.
 
Ranch Hand
Posts: 411
5
IntelliJ IDE Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The structure of that application is very cluttered with a lot of duplicated prompts in the various functions...

For hard-coded values it make no sense to pass those constants as arguments to the various functions... A better approach would be to define them before the function definitions...

To simulate an active/inactive account you can use a state variable before the function definitions as well...

With these recommendations we can knock up the following structure of the application:


This is just illustrative and opinionated with the purpose of trying to steer you in a better direction...
 
jin Otanashi
Ranch Hand
Posts: 123
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rico Felix wrote:The structure of that application is very cluttered with a lot of duplicated prompts in the various functions...

For hard-coded values it make no sense to pass those constants as arguments to the various functions... A better approach would be to define them before the function definitions...

To simulate an active/inactive account you can use a state variable before the function definitions as well...

With these recommendations we can knock up the following structure of the application:


This is just illustrative and opinionated with the purpose of trying to steer you in a better direction...



quiet interesting code but what happen when we get to use the array?
 
Rico Felix
Ranch Hand
Posts: 411
5
IntelliJ IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What array?... There weren't any mention of using arrays initially...
 
jin Otanashi
Ranch Hand
Posts: 123
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rico Felix wrote:What array?... There weren't any mention of using arrays initially...

that the second part of the note the i didn't include in the post. array and new account.
 
Rico Felix
Ranch Hand
Posts: 411
5
IntelliJ IDE Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Then we simply introduce a new type into the system and store it into our array:


Again: This is just illustrative and opinionated
 
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