Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A retail store has a preferred customer plan where customers can earn discounts on all their purchases.. The amount of a customers discount is determined

A retail store has a preferred customer plan where customers can earn discounts on all their purchases.. The amount of a customers discount is determined by the amount of the customers cumulative purchases in the store as follows::

When a preferred customer spends $500, he or she gets a 5 percent discount on all future purchases..

When a preferred customer spends $1,000, he or she gets a 6 percent discount on all future purchases.

When a preferred customer spends $1,500, he or she gets a 7 percent discount on all future purchases.

When a preferred customer spends $2,000 or more, he or she gets a 10 percent discount on all future purchases.

Problem Statement

Develop a PreferredCustomer .jjava class and write a test - driver program ( preferredCustomer Driver..jjava ) to test the class . Your implementation must meet the following design requirements..

Design Requirements

Begin by designing a class named Person withfields for holding a persons name,, address,, and telephone number.. Write one or more constructors and the appropriate mutator and accessor methods for the classs fields..

Next,, design a class named Customer , which extends the Person class.. The Customer class should have a field for a customer number and a Boolean field indicating whether the customer wishes to be on a mailing list.. Write one or more constructors and the ap propriate mutator and accessor methods for the classs fields..

The n,, design the PreferredCustomer c lass which extends the C ustomer class . The PreferredCustomer class should have fields for the amount of the customers purchases and the customers discount lev el.. Write one or more construc tors and the appropriat e mutator and accessor methods for the classs fields..

write a test - driver program , PreferredC ustomer Driver..jjava , to demonstrate the class.. The test - driver

Program Input

The test - drive r program obtains its data from a data file ( customer s..ttxt ) with data organized as follows.. Each line in the input file represents a preferred customer . Therefore,, each line consists of the following data values separated by semicolon s : customer name,, customer address,, customer phone number,, customer id,, a Boolean value (ttrue//ffalse)) , and a customer s purchases amount . Here are the first few lines in a sample input file::

Julie James; 123 Main Street , Allentown, NJ 44489; 567 - 555 - 1212; 147 - A049; true ; 1750.00

James Bryant; 567 Main Street , Allentown, NJ 44489; 789 - 555 - 8789; 147 - A078; false ; 2000.00

Program Output

The test - driver program displays the customer name as well as the customer s discount level. In addition, the program should generate two lists for interested customer. The first list is a mailing list consisting of

the customer address and phone number formatted in the usual format .

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

Concepts of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

7th edition

978-1111825911, 1111825912, 978-1133684374, 1133684378, 978-111182591

More Books

Students also viewed these Databases questions

Question

2. Why has the conflict escalated?

Answered: 1 week ago