import java.util.Scanner;
class Account{
private int ID, AccNo;
private String name;
private double balance;
public Account(int ID, int AccNo,String name, double
balance){
this.ID = ID;
this.AccNo = AccNo;
this.name = name;
this.balance = balance;
}
public void setName(String name){
this.name = name;
}
public void setBalance(double balance){
this.balance = balance;
}
public int getID(){
return ID;
}
public int getAccNo(){
return AccNo;
}
public String getName(){
return name;
}
public double getBalance(){
return balance;
}
public boolean deposit(double d){
if(d>0){
balance += d;
return true;
}
return false;
}
public boolean withdraw(double b){
if(b>balance)
return false;
balance -= b;
return true;
}
}
class JUCBank{
static int trackID=180000, trackAccNo=720000;
public static int getIndex(Account account[],int id,int n){
for(int i=0;i<n;i++){
if(account[i].getID()==id)
return i;
}
return -1;
}
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
int numAccounts,i=0;
System.out.println("Welcome to JUC Bank");
System.out.println("----------------------------------------");
System.out.println("Please enter the number of accounts you would
like to manage : ");
numAccounts = keyboard.nextInt();
Account account[] = new Account[5];
while(i<numAccounts){
System.out.println("----------------------------------------");
System.out.println("\nSelect a service from the following
list");
System.out.println("----------------------------------------");
System.out.println("1- Create new account\n2- Account Details\n3-
Deposit\n4- Withdraw\n5- Display all accounts details");
System.out.print("Your selection >>> ");
int selection = keyboard.nextInt();
if(selection==1){
System.out.println("**********Create new account*********");
System.out.print("Customer name: ");
keyboard.nextLine();
String name = keyboard.nextLine();
System.out.print("Balance: ");
double balance = keyboard.nextDouble();
account[i++] = new Account(trackID,trackAccNo,name,balance);
trackAccNo += 1;
trackID += 1;
}
else if(selection==2){
if(i==0)
System.out.print("No account has been created yet");
else{
System.out.println("*******All Account Details*******\n");
for(int j=0;j<i;j++)
System.out.println("Account holder: "+account[j].getName()+"
Account ID: "+account[j].getID()+" Account number:
"+account[j].getAccNo()+"\nBalance:"+account[j].getBalance());
}
}
else if(selection==3){
System.out.println("*************Money
Deposit**************");
System.out.print("Please Enter the Account ID : ");
int id = keyboard.nextInt();
int index = getIndex(account,id,i);
if(index>=0){
System.out.print("Enter the amount of money you would like to
deposit : ");
double d = keyboard.nextDouble();
if(!account[index].deposit(d))
System.out.print("deposit amount should be positive");
}else System.out.println("This is not a correct ID");
}
else if(selection==4){
System.out.print("*************Money
Withdraw***************\n");
System.out.print("Please Enter the Account ID : ");
int id = keyboard.nextInt();
System.out.print("Enter the amount of money you would like to
withdraw : ");
double w = keyboard.nextDouble();
int index = getIndex(account,id,i);
if(index>=0){
if(!account[index].withdraw(w))
System.out.println("Insufficient funds. Withdrawal not
made.");
}else System.out.println("This is not a correct ID");
}
else if(selection==5){
System.out.println("*******All Account Details*******\n");
for(int j=0;j<i;j++)
System.out.println("Account holder: "+account[j].getName()+"
Account ID: "+account[j].getID()+" Account number:
"+account[j].getAccNo()+"\nBalance:"+account[j].getBalance());
}
System.out.println("------------------------------------------------------");
System.out.println("Do you want to do another service [y- yes | n-
NO]: ");
char option = keyboard.next().charAt(0);
if(option=='n')
break;
System.out.print("\n");
}
}
}
//output screenshot
//any query, post in the comment section
This assignment must be completed on your own with your team mates. Don't give your code...
answer in c++ code.
use comments when writing the code to know what's your
thinking.
there is three pictures with information
Write a C++ console program that defines and utilizes a class named ATM. This program will demonstrate a composition relationship among classes because an ATM can contain many Accounts. You will need to reuse/modify the Account class you created in Assignment 10. The default constructor for the ATM class should initialize a private vector of 10 accounts, each with...
Java Code:
2. Define a class ACCOUNT with the following members: Private members Acno of type int Name of type String Balance of type float Public members void Init) method to enter the values of data members void Show) method to display the values of data members void Deposit(int Amt) method to increase Balance by Amt void Withdraw(int Amt) method to reduce Balance by Amt (only if required balance exists in account) float RBalance() member function that returns the value...
Need some help with this C++ code. Please screenshot the code if possible. Purpose: Demonstrate the ability to create and manipulate classes, data members, and member functions. This assignment also aims at creating a C++ project to handle multiple files (one header file and two .cpp files) at the same time. Remember to follow documentation and variable name guidelines. Create a C++ project to implement a simplified banking system. Your bank is small, so it can have a maximum of...
how can i code this only using a textbox for results Create Windows Forms applications called ATM Project that allows the customer to deposit the initial amount and enter the amount to be withdrawn. You need to display the total amount in the account, dispenses the money to the customer, and debits the account by the amount withdrawn including any service charges. The ATM allows a customer to withdraw a maximum of $500 per transition in $20 increments. If a...
Please i need the .H, .cpp and main.cpp files. Please use vector. its for my midterm so correct code that can run only. Thank you. Pointers and Dynamic Memory – Chapter 11 1. Write code using pointers and the Accounts class from week 1 assignment as follows – create a program in which you a. Create 10 accounts using an array with id’s 0 to 9 and refer to each account using pointer notation b. Add an initial balance of...
•create a new savings account object
(for choice 2).
•ask the user to enter an initial
balance which should be greater than 50. If the entered amount is
less than 50, the program will ask the user to enter another
amount. This continues until an amount greater than 50 is
entered.
•Set the balance of the savings account
object by calling the setBalance() method.
•Ask the user to deposit an amount.
Deposit that amount and display the balance of the...
*This question was posted earlier but I want to make sure my code differs from the other answer* CS50 Assignment 3 and Assignment 4 (Both Due By Sunday March 29 11:59 PM) Assignment 3: Bank Application In a recent lecture, we discussed getting input from the user by using the scanf() function. For your reference, I have included a simple example of using scanf() below: scanf() example: #include int main(void) { int number; printf("Enter a number: "); //prompt the user...
Purpose: Demonstrate the ability to create and manipulate classes, data members, and member functions. This assignment also aims at creating a C++ project to handle multiple files (one header file and two .cpp files) at the same time. Remember to follow documentation and variable name guidelines. Create a C++ project to implement a simplified banking system. Your bank is small, so it can have a maximum of 100 accounts. Use an array of pointers to objects for this. However, your...
please rewrite this code as Pseudo-Code,.. basically rewrite the code but in english language , Thank you so much! public abstract class BankAccount { //declare the required class variables private double balance; private int num_deposits; private int num_withdraws; private double annualInterest; private double serviceCharges; //constructor that takes two arguments // one is to initialize the balance and other // to initialize the annual interest rate public BankAccount(double balance,...
Banking System is developed in C++ to replaced manual System by a computerized system. This system allows to create a new account and Allows to deposit and withdrawal amount facilities. Account Holder ABS must record the detailed information of each account holder, such as Type of his account (see next slides for more info) Type of Credit card (see later slides for more info) First name, middle name, and last name CNIC number Address Telephone number Date of...