Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A newspaper company sells advertisement space in their newspaper. Advertisers buy space based on amount of space wanted in a newspaper page full page, half

A newspaper company sells advertisement space in their newspaper. Advertisers buy space based on amount of space wanted in a newspaper page full page, half page, quarter page and business card size. Customer also indicates how many days the advertisement would run. Advertisers receive a discount based on the total cost of the advertisement sale.

Design:

The classes should be placed in a package with the name edu.ilstu

Non-application classes Advertisement and AdSale should have complete Javadoc comments.

You will need to use the following classes for your program:

Advertisement class

Keeps track of the information for Advertisements. This class should include the following:

Named Constants Make these privatePrices for advertisement size

Full page at $50

Half-page at $30

Quarter page at $20

Business card size at $10

Methods

Getters for all the constants

A method that accepts the character code for advertisement space size and returns the price for the space. The codes for the advertisement size are:

F Full page

H Half-page

Q Quarter page

B Business card

A method that accepts the total cost of the sale and returns the discount amount. Total cost of at least $200 but less than $500 receives a 10% discount, a sale of at least $500 will receive a discount of 15%.

AdSale class

Keeps track of the information for the sale of an advertisement space. This class should include the following:

Instance variables

a field to store the adType (F, H, Q, or B)

a field to store first name of customer

a field to store last name of customer

a field to store the number of days the ad would run

a field to store the price of the ad space

Methods

a constructor that accepts values for all instance fields except for price

getters for all instance fields

setter for number of days to run ad and the price of the advertisement space

a method to calculate the cost of the sale based on the price and the number of days to run the ad

A method to return the final cost of the sale based on total cost less the discount amount. This method accepts the discount amount.

A method to run the full description of the advertisement space

F Full page

H Half-page

Q Quarter page

B Business card size

toString method that formats the Advertisement information name of customer, ad description, number of days to run ad and price. See sample output run.

AdSalesApp class

This is the starting point for the application, which is the only class to contain a main method. You will use both the Advertisement and AdSale classes here. For this program, the main method handles all of the input and output for the program and will perform the following tasks:

Create the instance of Advertisement class and AdSale.

Follow the sample interaction on what to display for prompts, labels, messages and the flow for screen input and outputs.

Display the Ad space sizes and prices

Ask user for type of ad, name and number of days to run.

Display the billing summary. Discount information should not be displayed if there is no discount.

Review the sample run of the program to determine how the interaction with the user should flow.

Sample output with discount:

Advertisement Options:

F - Full page ad 50.00

H - Half page ad 30.00

Q - Quarter page ad 20.00

B - Business card page ad 10.00

Please make your selection

Enter ad option (F, H, Q or B): F

Enter first name: Anne

Enter last Name: Smith

Enter number of days ad would run: 12

Bill Summary

Anne Smith

Ad type: Full page

Days to run ad: 12

Price: $50.00

Total cost: 600.00

Discount: $90.00

Final Cost: $510.00

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

Oracle 11G SQL

Authors: Joan Casteel

2nd Edition

1133947360, 978-1133947363

More Books

Students also viewed these Databases questions

Question

3. Is IBMs program really a mentoring program? Why or why not?

Answered: 1 week ago