Java programming modifing as question.

Java Programing 1 - 24206-CSC325-0


Project3

Bank Account – Part 2


Modify the Bank Account class you created to have the

following additional functionality

-       

When the object is created, it should create two

types of account

o  

Checking and Saving ( you can user Boolean

variables to identify between these accounts)

o  

Initialize balance on both accounts to $0 

o  

The constructor calls a method called

setAccountPassWord()


setAccountPassWord ()

1.     

This method asks the user to enter a pin number.

2.     

It checks to make sure the Pin number is between

4-8 digit numerical value

3.     

It calls another method called encryptData()

4.     

the value return from enCryptData is stored as

the user security pin number.

enCryptData()

1.     

This method takes integer value as its argument

2.     

It encrypts the integer value using mod21

encryption security.

3.     

Returns the encrypted value to calling function.

Example

                                             12345 %21  - this returns 18

which is the remainder

                          

       656564 % 21 –

this returns 20 which is the remainder


Add the following additional methods

Withdraw ()

1-    

Asks for security pin.

2-    

Checks if pin entered matches the user security

a.     

If not, continue to ask user for security pin

until valid pin is entered.

3-    

Asks if withdraw from checking account or saving

account

4-    

Checks If withdraw amount is less than balance

5-    

Withdraws the amount, and updates account

balance

Deposit()

1-    

Asks for security pin.

2-    

Checks if pin entered matches the user security

a.     

If not, continue to ask user for security pin

until valid pin is entered.

3-    

Asks if withdraw from checking account or saving

account

4-    

Updates account balance with new balance

Transfer()

1-    

        Asks

for security pin.

2-    

Checks if pin entered matches the user security

a.     

If not, continue to ask user for security pin

until valid pin is entered.

3-    

Asks from and to account to transfer money

(checking to saving or saving to checking_

4-    

Updates both accounts balance


DisplayBalance()

1-    

Asks for security pin.

2-    

Checks if pin entered matches the user security

a.     

If not, continue to ask user for security pin

until valid pin is entered.

3-    

 Prints

the account balance on both checking and Saving


Test your code with the followings

1-    

Create an account called myAccount

a.     

Call DisplayBalance()

2-    

Deposit $100 in saving account

3-    

Deposit $150 in checking account

a.     

Display Balance

4-    

Transfer $50 from saving account into checking

account

a.     

Display balance

5-    

Try to withdraw $200 from your saving account

and see what happens.   You must properly

display code and inform the end user if there is not funding in the account                  

6-    

Withdraw $25 from saving account

    Display Balance

              


Classes

to be modified:


BankAccount.Java:


import java.util.Scanner;

public class BankAccount

{

   // Create a Scanner object

   Scanner in = new Scanner(System.in);

   // Declare the necessary member variables

   private String acctHolderFirstName;

   private String acctHolderLastName;

   private double acctBalance;

   private String acctType;

   // Define the default constructor for the

class

   public BankAccount()

   {

       // Initialize account balance to zero

       acctBalance = 0;

       // Initialize account type to checking

       acctType = "Checking";

       // Call the getAccountInfo() method

       getAccountInfo();

   }

   // Define the parameterized constructor for

the class

   public BankAccount(String firstName,

String lastName, double Balance, String Type)

   {

       // Assign the values to the member

variables

       acctHolderFirstName = firstName;

       acctHolderLastName = lastName;

       acctBalance = Balance;

       acctType = Type;

   }

   // Define the getAccountInfo() method

   public void getAccountInfo()

   {

       // Prompt user to enter first name

       System.out.print("First

Name: ");

       // Assign the user input to the member

variable

       acctHolderFirstName = in.next();

       // Prompt user to enter last name

       System.out.print("Last

Name: ");

       // Assign the user input to the member

variable

       acctHolderLastName = in.next();

       // Prompt user to enter account type

       System.out.print("Account

Type: ");

       // Assign the user input to the member

variable

       acctType = in.next();

   }

   // Define the Deposit() method

   public void Deposit()

   {

       // Prompt user to enter the amount to

deposit

       System.out.print("Enter

the amount to deposit to the account: ");

       // Assign the user input to a double

variable

       double deposit = in.nextDouble();

       // Add the value entered by user to the

current account balance

       acctBalance += deposit;

   }

   // Define the displayBalance() method

   public void displayBalance()

   {

       // Display the account holder's last

name

       System.out.println("Account

Holder's Last Name: " + acctHolderLastName);

       // Display the account type

       System.out.println("Account

Type: " + acctType);

       // Display the current account balance

       System.out.println("Current

Balance in the account: $" + acctBalance);

   }

}

TestAccountBalance.Java:


public class TestAccountBalance

{

   public static

void main(String[] args)

   {

       System.out.println("Ronaldo's

Account Information");

       // Create an

object of the BankAccount class

       // The object

uses the default constructor of the class

       BankAccount RonaldoAccount

= new BankAccount();

       // Print a

blank line

       System.out.println();

       // Call the

displayBalance() method using the object

       RonaldoAccount.displayBalance();

       // Print a

blank line

       System.out.println();

       // Call the

Deposit() method using the object

       RonaldoAccount.Deposit();

       // Print a

blank line

       System.out.println();

       // Call the

displayBalance() method using the object

       RonaldoAccount.displayBalance();

     

       // Print a

blank line

       System.out.println("\n");

       System.out.println("Kaylyn's

Account Information");

       // Create an

object of the BankAccount class

       // The object

uses the parameterized constructor of the class

       BankAccount KaylynAccount

= new BankAccount("Kaylyn", "Kyle", 895, "Saving");

       // Call the

displayBalance() method using the object

       KaylynAccount.displayBalance();

       // Print a

blank line

       System.out.println();

       // Call the

Deposit() method using the object

       KaylynAccount.Deposit();

       // Print a

blank line

       System.out.println();

       // Call the

displayBalance() method using the object

       KaylynAccount.displayBalance();

   }

}

Get Help With a similar task to - Java programming modifing as question.

Login to view and/or buy answers.. or post an answer
Additional Instructions:

Java Programing 1 - 24206-CSC325-0 Project 3 Date Due: 2/28/2020 Bank Account – Part 2 Modify the Bank Account class you created to have the following additional functionality · When the object is created, it should create two types of account · Checking and Saving ( you can user Boolean variables to identify between these accounts) · Initialize balance on both accounts to $0 · The constructor calls a method called setAccountPassWord() setAccountPassWord () 1. This method asks the user to enter a pin number. 2. It checks to make sure the Pin number is between 4-8 digit numerical value 3. It calls another method called encryptData() 4. the value return from enCryptData is stored as the user security pin number. enCryptData() 1. This method takes integer value as its argument 2. It encrypts the integer value using mod21 encryption security. 3. Returns the encrypted value to calling function. Example 12345 %21 - this returns 18 which is the remainder 656564 % 21 – this returns 20 which is the remainder Add the following additional methods Withdraw () 1- Asks for security pin. 2- Checks if pin entered matches the user security a. If not, continue to ask user for security pin until valid pin is entered. 3- Asks if withdraw from checking account or saving account 4- Checks If withdraw amount is less than balance 5- Withdraws the amount, and updates account balance Deposit() 1- Asks for security pin. 2- Checks if pin entered matches the user security a. If not, continue to ask user for security pin until valid pin is entered. 3- Asks if withdraw from checking account or saving account 4- Updates account balance with new balance Transfer() 1- Asks for security pin. 2- Checks if pin entered matches the user security a. If not, continue to ask user for security pin until valid pin is entered. 3- Asks from and to account to transfer money (checking to saving or saving to checking_ 4- Updates both accounts balance DisplayBalance() 1- Asks for security pin. 2- Checks if pin entered matches the user security a. If not, continue to ask user for security pin until valid pin is entered. 3- Prints the account balance on both checking and Saving Test your code with the followings 1- Create an account called myAccount a. Call DisplayBalance() 2- Deposit $100 in saving account 3- Deposit $150 in checking account a. Display Balance 4- Transfer $50 from saving account into checking account a. Display balance 5- Try to withdraw $200 from your saving account and see what happens. You must properly display code and inform the end user if there is not funding in the account 6- Withdraw $25 from saving account Display Balance Classes to be modified: BankAccount.Java import java.util.Scanner; public class BankAccount { // Create a Scanner object Scanner in = new Scanner(System.in); // Declare the necessary member variables private String acctHolderFirstName; private String acctHolderLastName; private double acctBalance; private String acctType; // Define the default constructor for the class public BankAccount() { // Initialize account balance to zero acctBalance = 0; // Initialize account type to checking acctType = "Checking"; // Call the getAccountInfo() method getAccountInfo(); } // Define the parameterized constructor for the class public BankAccount(String firstName, String lastName, double Balance, String Type) { // Assign the values to the member variables acctHolderFirstName = firstName; acctHolderLastName = lastName; acctBalance = Balance; acctType = Type; } // Define the getAccountInfo() method public void getAccountInfo() { // Prompt user to enter first name System.out.print("First Name: "); // Assign the user input to the member variable acctHolderFirstName = in.next(); // Prompt user to enter last name System.out.print("Last Name: "); // Assign the user input to the member variable acctHolderLastName = in.next(); // Prompt user to enter account type System.out.print("Account Type: "); // Assign the user input to the member variable acctType = in.next(); } // Define the Deposit() method public void Deposit() { // Prompt user to enter the amount to deposit System.out.print("Enter the amount to deposit to the account: "); // Assign the user input to a double variable double deposit = in.nextDouble(); // Add the value entered by user to the current account balance acctBalance += deposit; } // Define the displayBalance() method public void displayBalance() { // Display the account holder's last name System.out.println("Account Holder's Last Name: " + acctHolderLastName); // Display the account type System.out.println("Account Type: " + acctType); // Display the current account balance System.out.println("Current Balance in the account: $" + acctBalance); } } TestAccountBalance.Java public class TestAccountBalance { public static void main(String[] args) { System.out.println("Ronaldo's Account Information"); // Create an object of the BankAccount class // The object uses the default constructor of the class BankAccount RonaldoAccount = new BankAccount(); // Print a blank line System.out.println(); // Call the displayBalance() method using the object RonaldoAccount.displayBalance(); // Print a blank line System.out.println(); // Call the Deposit() method using the object RonaldoAccount.Deposit(); // Print a blank line System.out.println(); // Call the displayBalance() method using the object RonaldoAccount.displayBalance(); // Print a blank line System.out.println("\n"); System.out.println("Kaylyn's Account Information"); // Create an object of the BankAccount class // The object uses the parameterized constructor of the class BankAccount KaylynAccount = new BankAccount("Kaylyn", "Kyle", 895, "Saving"); // Call the displayBalance() method using the object KaylynAccount.displayBalance(); // Print a blank line System.out.println(); // Call the Deposit() method using the object KaylynAccount.Deposit(); // Print a blank line System.out.println(); // Call the displayBalance() method using the object KaylynAccount.displayBalance(); } }

Related Questions

Similar orders to Java programming modifing as question.
43
Views
0
Answers
PG2 – LAB 2: BLACKJACK OBJECTS
CONTENTS Overview........................................................................................................................................................................2 Part A - Classes......................................................
24
Views
0
Answers
Excel Project with Documentation
In a new sheet, create one-variable data tables for these food items. For each previously selected food item, create a two-variable data table that calculates the amounts of calories based on various portion sizes and the number of portions. I have att...
52
Views
0
Answers
Computer Vision - (Machine Learning, Artificial Intelligence field) assignment in python
Video processing, image processing, object detection, object tracking, background removel. It needs to be in PYTHON. Objective The goal of this project is to develop an automatic system for video analysis of footages for the game of curling. The system...
19
Views
0
Answers
Writing and understanding simple java program code
I need help writing a java program with an Eclipse IDE. Once written I need to identify, objects, lists, algorithms, set of instructions, anything that explains how the code is written, what it does, and how an end user will use it...