I need help with design. This material is somewhat more theoretical than that of
ID: 3804883 • Letter: I
Question
I need help with design.
This material is somewhat more theoretical than that of previous topics, so instead of writing a program for this assignment, you are going to work on a design. Specifically, your task is to design a class to represent a credit card. Try to design your class such that it only includes fields and methods relative to a credit card itself, without branching out into related functionality, like that of a bank or a consumer. At the same time, try to make your class as complete as possible, so that it can be used in any application that involves a credit card. To complete this assignment, you will turn in a text document (Word or PDF) with the following information: • A list of the fields and methods of your class. For fields you will need to specify the type, the accessibility (private, public, etc), whether it is a static or instance field, and any limitations on the values (non-negative, always less than some other value, etc). For the methods, you will need to supply the return type and parameter type list. • A free-form description of what each field and method is meant to do, with explanation of any potentially confusing design decisions. • A justification for your design based on the guidelines given in section 10.11 of your textbook.
This is what the assignment says it needs a design for a credit card like name, password...same to what a regular credit card have just without consumer and bank stuff
Explanation / Answer
Public class CreditCard
Members:
Private String name
Private String password
Private Date date_of_issue
Private Date date_of_expiry
Private Double balance
Private static final Double creditLimit = 5000; // for 5000Dollars
Private Double TransactionLimit;
private Boolean isActive;
constructor
CreditCard(Name, Password, balance, TransactionLimit)
set card to active, set the name, password, balance and transactionLimit
set date_of_issue to today and date_of_expiry to 10 years later
Methods
public debit(password, amount)
Debit the amount, if password matches and balance is greater than the amount to be withdrawn
public credit(amount)
Credit the amount, sum the amount to balance
public getNameOnCard()
return name of the card holder
public isCardWorking()
return if date_of_expiry is after today's date and if card is in active state
public getBalance()
return the balance
public getCreditLimit()
return the creditLimit
public getTransactionLimit()
return the transactionLimit
public isActive()
return true is card is active
public setName(name)
set card holder name
public setPassword(pass)
set password for the card
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.