Goal the purpose of this lab is to demonstrate an


Goal: The purpose of this lab is to demonstrate an understanding of static variables and methods.

Problem: You are working for Plastercard, Inc., a company that specializes in credit cards for handymen.

The company plans to launch a new credit card and needs your help in designing an object-oriented application to run usage of the credit card.

Based on some requirements analysis, you create the following detailed UML diagram for a CreditCard class:

(+) DEFAULT_CREDIT_LIMIT: double The default credit limit across all credit cards ($1000.00)

(-) numOpenAccounts: int The number of open credit card accounts

(-) lastAccountNumber: int Starting at 200, the last account number assigned

(-) accountNumber: int The account number of the credit card

(-) numCyclePurchases: int The number of purchases made in a billing cycle of the credit card

(-) balance: double The balance of the credit card

(-) creditLimit: double The credit limit of the credit card

(-) open: boolean The status of the credit card (open or closed)

(+) CreditCard() Constructs a default CreditCard object with an account number, number of purchases made in a billing cycle, balance,credit limit, and open status

(+) CreditCard(creditLimit : double) Constructs a CreditCard object with a specified credit limit

(+) getAccountNumber(): int Returns the account number of this credit card

(+) getNumCyclePurchases(): int Returns the number of purchases made in a billing cycle of this credit card

(+) getBalance(): String Returns the balance of this credit card

(+) getCreditLimit() : double Returns the credit limit of this credit card

(+) isOpen(): boolean Returns the status of this credit card (open or closed)

(+) getNumOpenAccounts(): int Returns the number of open credit card accounts

(+) charge(amount : double): boolean Returns if a credit card charge was successful if the account was open, a valid amount was provided, and the balancewould not exceed the credit limit. The amount is added to the balance and the number of purchases made in the billing cycle is incremented

(+) payBill(amount : double): boolean Returns if the credit card bill was successfully paid if theaccount was open and the amount to pay equaled the amount of the balance. The balance and number of purchases made inthe billing cycle is reset to 0

(+) close(): boolean Returns if the credit card was successfully closed only If thecredit card was open

(+) toString(): String Returns a string representation of this Credit Card

First, create a data definition class based solely on the above detailed UML diagram. Then, create animplementation class that tests each of the methods of the data definition class. No user input is required in the implementation class. Rather, data can be hardcoded. Attempt to replicate a running of the application as shown in the screenshots below. You can start with the following skeleton which may help you:

import javax.swing.JOptionPane;

public class Lab3_CreditCardImplementation {

public static void main(String[] args) {

Lab3_CreditCard creditCard1 = new Lab3_CreditCard();

Lab3_CreditCard creditCard2 = new Lab3_CreditCard(2000.00);

}

}

Request for Solution File

Ask an Expert for Answer!!
Programming Languages: Goal the purpose of this lab is to demonstrate an
Reference No:- TGS01082501

Expected delivery within 24 Hours