Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A cash processing company has a class called Account used to process transactions: Method/Constructor: public Account(Client c) Description:constructs an account using client information public boolean

A cash processing company has a class called Account used to process transactions:

Method/Constructor: public Account(Client c) Description:constructs an account using client information

public boolean process(Transaction t)- processes the next transaction, returning true if the transaction was approved, false otherwise

Account objects interact with Transaction objects, which have many methods including:

Method/Constructor-public int value() Description- returns the value of this transaction in pennies (could be negative, positive or zero)

The company wishes to create a slight modification to the Account class that filters out zero-valued transactions. Design a new class called FilteredAccount whose instances can be used in place of an Account object but which include the extra behavior of not processing transactions with a value of 0. More specifically, the new class should indicate that a zero-valued transaction was approved but shouldn't call the process method in the Account class to process it. Your class should have a single constructor that accepts a parameter of type Client, and it should include the following method:

Method/Constructor: public double percentFiltered() Description: returns the percent of transactions filtered out (between 0.0 and 100.0); returns 0.0 if no transactions submitted

Assume that all transactions enter the system by a call on the process method described above.

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_2

Step: 3

blur-text-image_3

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

Database Concepts

Authors: David M Kroenke, David J Auer

6th Edition

0132742926, 978-0132742924

More Books

Students also viewed these Databases questions