Question: IF YOU DO NOT HAVE THE UML and PSEUDO-CODE, YOU HAVE TO READ THE BELOW REQUIREMENT THEN CREATE UML OF DATA TYPE CLASS AND WRITE


IF YOU DO NOT HAVE THE UML and PSEUDO-CODE, YOU HAVE TO READ THE BELOW REQUIREMENT THEN CREATE UML OF DATA TYPE CLASS AND WRITE THE PSEUDO-CODE BEFORE WRITING THE CODE


DATA TYPE CLASS

Class SP2022_CreditCardAccount_yourLastName

This class SP2022_CreditCardAccount that holds the information of one credit card about credit card number, csv number, name, available credit, current balance, last statement balance, interest rate.


-The credit card number (String) is generated as random number with 16 digits (SEE HOW TO DO LAB)

-The csv number (String) is generated as random number with 3 digits

-The name is read from the keyboard

-available amount is set to CREDIT_LINE that is a constant passed from the keyboard

-current balance is initialized to 0

-statement balance is initialized to 0

-interest rate is set to INTEREST_RATE that is a constant passed from the keyboard


Also, the class includes some methods to do the following tasks: open new credit card account, verify account, verify csv, process one transaction, read interest rate, read credit line, payment process.


Method verifyAccountNumber

-the method accepts the account number that is passed from the driver class

-compare the account number to credit card number

If they are the same return true; otherwise return false


Method verifyCSV

-the method accepts the csv number that is passed from the driver class

-compare the csv number to csv

If they are the same return true; otherwise return false


Method generateCurrentDate

import java.text.SimpleDateFormat;

import java.util.Date;


public String getCurrentDate()

{

SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/yyyy");

Date date = new Date();

return formatter.format(date);

}


Method generateCreditCardNumber

import java.util.Random;

public static String generateCreditCardNumber()

{

Random rand = new Random();

int value1 = rand.nextInt(9000) + 1000;

int value2 = rand.nextInt(9000) + 1000;

int value3 = rand.nextInt(9000) + 1000;

int value4 = rand.nextInt(9000) + 1000;

return String.valueOf(value1) + String.valueOf(value2) +

String.valueOf(value3) + String.valueOf(value4);

}


Method OPEN NEW CREDIT CARD ACCOUNT: display the following output


File: SP2022_CreditCardService_Martinez.java

OPEN NEW CREDIT CARD ACCOUNT - LUIS MARTINEZ

------------------------------------------------------

Name: Mary Lane

Card Number: 6124280537103054

csv: 265

------------------------------------------------------

Available Amount: 5000.00

Current Balance: 0.00

Statement Balance: 0.00

Interest Rate: 14.29%


Method PROCESS ONE TRANSACTION

-Method must accept the transaction amount that is passed from the keyboard read from the driver class.

-if the transaction amount is greater than available amount then display message "Invalid transaction amount"

Otherwise, calculate:

Available amount = available amount - amount

Current balance = current balance + amount


-Display the following output:


File: SP2022_CreditCardService_Martinez.java

PROCESS TRANSACTION CREDIT CARD ACCOUNT - LUIS MARTINEZ

------------------------------------------------------

Name: Mary Lane

Card Number: 6124280537103054

------------------------------------------------------

Transaction Amount: 624.36

Current Balance: 624.36

Available Amount: 4375.64



File: SP2022_CreditCardService_Martinez.java

PROCESS TRANSACTION CREDIT CARD ACCOUNT - LUIS MARTINEZ

------------------------------------------------------

Name: Mary Lane

Card Number: 6124280537103054

------------------------------------------------------

Transaction Amount: 728.28

Current Balance: 1352.64

Available Amount: 3647.36


Method READ CURRENT BALANCE

-Display the following output:


File: SP2022_CreditCardService_Martinez.java

CREDIT CARD SERVICE - LUIS MARTINEZ

------------------------------------------------------

Name: Mary Lane

Card Number: 6124280537103054

Current Balance: 1352.64


Method READ INTEREST RATE

-Display the following output:


File: SP2022_CreditCardService_Martinez.java

CREDIT CARD SERVICE - LUIS MARTINEZ

------------------------------------------------------

Name: Mary Lane

Card Number: 6124280537103054

Interest Rate: 14.29%


Method PRINT STATEMENT

-Display the following output:


File: SP2022_CreditCardService_Martinez.java

CREDIT CARD SERVICE STATEMENT - LUIS MARTINEZ

Date: 03/06/2022

------------------------------------------------------

Name: Mary Lane

Card Number: 6124280537103054

------------------------------------------------------

Available Amount: 3647.36

Statement Balance: 1352.64



Method Payment Process

-The method must accept the payment amount that passed from the driver class

-calculate the following:

The balance left = statement amount - payment amount

Interest mount = balance left * interest rate / 100

The current balance = balance left + interest amount

Available amount = available amount + payment amount


File: SP2022_CreditCardService_Martinez.java

CREDIT CARD PAYMENT PROCESS - LUIS MARTINEZ

Date: 03/06/2022

------------------------------------------------------

Name: Mary Lane

Card Number: 6124280537103054

------------------------------------------------------

Statement Amount: 1352.64

Payment Amount: 800.00

Interest Amount: 78.97

Current Balance: 631.61

Available Amount: 4447.36


DRIVER CLASS

Class SP2022_CreditCardService_yourLastName

Declare float constant for CREDIT_LINE = 5000.00 and INTEREST_RATE = 14.29


First the application displays the following menu to allow users to select a task.

SP2022_CreditCardService_Martinez.java

CREDIT CARD SERVICE MENU - LUIS MARTINEZ

--------------------------------------------

1.Open new credit card account

2.Process One transaction

3.Read Current Balance

4.Read Interest Rate

5.Payment process

0.Exit


Read the number from users.

If users select the task 2 to task 5 before selecting task 1, the application must display the message "You must select 1 to open credit account first." Then redisplay the menu to allow users to open account."


TASK 1. OPEN NEW CREDIT CARD ACCOUNT

-Read from the keyboard about customer name (String)

-Create credit card account object with the name, CREDIT_LINE, INTEREST_RATE.

-Use the object to access the method to open new credit card account of the class SP2022_CreditCardAccount_yourLastName to display the information of the new account.


TASK 2. PROCESS ONE TRANSACTION

-Display the message and read from the keyboard the credit card number

-Use the object created at Task1, to access method verifyAccountNumber() of class SP2022_CreditCardAccount_yourLastName

-If method verifyAccountNumber() return false; display message "Invalid Credit Card Number"

Otherwise, display message to ask and read the transaction amount and csv number

-Use the object to access method verifyCSV of class SP2022_CreditCardAccount_yourLastName

-if method verifyCSV return false, display message "Invalid CSV"

Otherwise, use the objectto access the method of class SP2022_CreditCardAccount_yourLastName to process one transaction


TASK 3. READ CURRENT BALANCE

-Display the message and read from the keyboard the credit card number

-Use the object created at Task1, to access method verifyAccountNumber() of class SP2022_CreditCardAccount_yourLastName

-If method verifyAccountNumber() return false; display message "Invalid Credit Card Number"

Otherwise, use object to access the method of class SP2022_CreditCardAccount_yourLastName to display the current balance



TASK 4. READ INTEREST RATE:

-Display the message and read from the keyboard the credit card number

-Use the object created at Task1, to access method verifyAccountNumber() of class SP2022_CreditCardAccount_yourLastName

-If method verifyAccountNumber() return false; display message "Invalid Credit Card Number"

Otherwise, use object to access the method of class SP2022_CreditCardAccount_yourLastName to display the interest rate


TASK 5. PRINT STATEMENT

-Display the message and read from the keyboard the credit card number

-Use the object created at Task1, to access method verifyAccountNumber() of class SP2022_CreditCardAccount_yourLastName

-If method verifyAccountNumber() return false; display message "Invalid Credit Card Number"

Otherwise, use object to access the method of class SP2022_CreditCardAccount_yourLastName to display the statement.


TASK 6. PAYMENT PROCESS

-Display the message and read from the keyboard the credit card number

-Use the object created at Task1, to access method verifyAccountNumber() of class SP2022_CreditCardAccount_yourLastName

-If method verifyAccountNumber() return false; display message "Invalid Credit Card Number"

Otherwise, use object to access the method of class SP2022_CreditCardAccount_yourLastName to process the payment.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!