Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CreditCardDemo: CreditCardDemo in text: //Demonstrates the CreditCard class public class CreditCardDriver { public static void main(String[] args) { final Money LIMIT = new Money(1000); final

image text in transcribedimage text in transcribed

CreditCardDemo:

image text in transcribed

CreditCardDemo in text:

//Demonstrates the CreditCard class

public class CreditCardDriver { public static void main(String[] args) { final Money LIMIT = new Money(1000); final Money FIRST_AMOUNT = new Money(200); final Money SECOND_AMOUNT = new Money(10.02); final Money THIRD_AMOUNT = new Money(25); final Money FOURTH_AMOUNT = new Money(990); Person owner = new Person("Horton", "Jackie", new Address("333 Votey Hall", "Burlington", "VT", "05405")); CreditCard visa = new CreditCard(owner, LIMIT); System.out.println(visa.getPersonals()); System.out.println("Balance: " + visa.getBalance()); System.out.println("Credit Limit: " + visa.getCreditLimit()); System.out.println(); System.out.println("Attempt to charge " + FIRST_AMOUNT); visa.charge(FIRST_AMOUNT); System.out.println("Balance: " + visa.getBalance()); System.out.println("Attempt to charge " + SECOND_AMOUNT); visa.charge(SECOND_AMOUNT); System.out.println("Balance: " + visa.getBalance()); System.out.println("Attempt to pay " + THIRD_AMOUNT); visa.payment(THIRD_AMOUNT); System.out.println("Balance: " + visa.getBalance()); System.out.println("Attempt to charge " + FOURTH_AMOUNT); visa.charge(FOURTH_AMOUNT); System.out.println("Balance: " + visa.getBalance()); } }

CreditCard balance:Money creditLimit:Money owner: Person +CreditCard(newCardHolder:Person, limit:Money) +getBalance) :Money +getCreditLimit(): Money +getPersonals():String + charge(amount Money) :void +payment(amount Money): void Money Person -dollarslong astName: String firstName:String cents - home: Address +Money(amountdouble): +MoneylotherObject:Money) +toString):String add(otherAmount Money): Money +subtract otherAmount Money): Money +compareTo(otherObject:Money): int +equals(otherObject Money):boolean +toStringl):String Address street:String city: String state:String zip:String toString:String CreditCard balance:Money creditLimit:Money owner: Person +CreditCard(newCardHolder:Person, limit:Money) +getBalance) :Money +getCreditLimit(): Money +getPersonals():String + charge(amount Money) :void +payment(amount Money): void Money Person -dollarslong astName: String firstName:String cents - home: Address +Money(amountdouble): +MoneylotherObject:Money) +toString):String add(otherAmount Money): Money +subtract otherAmount Money): Money +compareTo(otherObject:Money): int +equals(otherObject Money):boolean +toStringl):String Address street:String city: String state:String zip:String toString:String

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Conceptual Database Design An Entity Relationship Approach

Authors: Carol Batini, Stefano Ceri, Shamkant B. Navathe

1st Edition

ISBN: 0805302441, 978-0805302448

More Books

Students also viewed these Databases questions