Red Fan Advertising requires a simple newspaper advert price calculator prototype to demonstrate key features. The size, position and type (colour or black & white) of the advert are used to calculate the price.
Adverts position can be:
The height of the advert is measured in centimetres (must be between 10 and 70 and a multiple of 5).
The width is measured in columns (maximum of 5).
The basic price is calculated using the following formula: Height x Width x Rate (see table below).
Advertising Rates (in pence) See image.
If artwork is required, a 15% charge is applied to the basic price (capped at $30).
Each advert is assigned a reference number (e.g. A123ED A letter followed by three digits and two letter. The first letter can only be A for Account Transaction or C for Cash Transaction).
Account transactions receive a 10% discount.
All calculations are performed on the pence values and decimal portion disregarded.
Advert details also include the client name (eg: S Jones) maximum of 30 characters
As well as processing orders at its main office, Red Fan also receive order data from an agent in the form of a text file (a single file containing multiple advert details).
When required, summary outputs should be displayed using the following format:
+---------------------------------------+
| |
| Client: S Jones |
| |
| Date: 15 Nov 2014 Ref: A123ED |
| Position: Run Type: Colour |
| Columns: Three Height: 15cm |
| |
| Artwork: No Charge: None |
| |
| Discounted Price: $57.28 |
| |
+---------------------------------------+
Notes:
A prototype console application (no GUIs or GUI dialogs) is required. Your prototype should display a menu similar to the following:
Once an option is selected and processed, the menu should be redisplayed until the exit option is selected. Each operation is described below:
Ask the user for the inputs: client name, type, position, height, width, artwork required and reference. Note: All inputs should be validated.
Calculate the total and discounted prices for the advert.
Display the advert summary (it must use the format in the example).
Save (append) the data for the advert to the text-based summary file (adverts.txt). Each line in the file must hold the details for a single advert with the following information separated by spaces or tabs:
User is asked to select the main (main.txt) or agent (agent.txt) adverts and a summary of the following is displayed:
A sample agent file can be downloaded from Blackboard. For the supplied agent file, the output should look similar to the following:
Total Number of adverts: 1000
Number of colour adverts (inc. Wrappers): 597
Average pre-discounted price of adverts (exc. Wrappers): 210.40
Number of adverts per Month:
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
88 62 101 73 90 92 86 108 61 77 75 87
The user is asked to select the main or agent adverts and to enter a month. A summary of adverts (as specified in option 2) should then be displayed for the specified month.
The user is asked to select the main or agent adverts and enter the search text. The selected file should be searched for any matches (full or partial) against the reference or client name. For example entering DE would match against reference number A123DE and Client Name C Sanderson.
For each matching entry, the advert summary (see option 1) should be displayed.
Display an appropriate message and exit the application.
As well as developing the prototype, the client requires a test plan for the application that demonstrates how each feature will be tested to ensure that it performs as expected. The test plan should use the following format:
Description Values/Input Expected outcome Actual outcome
Once the test plan has been completed, use it to check your design and application. If any of the tests fail, update your application and re-test (keep the original entry that failed in the plan along with the new entry for the re-test).
Name your project AdvertManager.
Data files must be named main.txt and agent.txt. A sample of the agent file can be downloaded from the Assessment section of the blackboard module.
The implementation must include an Advert class that represents a single advert. This class should use appropriate encapsulation and not include any keyboard input or console output.
The following method will get todays date:
public static String getDate()
{
Calendar cal = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("dd-MMM-yyyy");
return sdf.format(cal.getTime());
}
You will need to import java.util.Calendar and java.text.SimpleDateFormat;
Internally use integers for monetary values (hold them as pence). Display as pounds and pence by dividing the value by 100 and using the printf method to display for example:
System.out.printf("$%.2f ", amount / 100.0);
The prototype must be developed in NetBeans.