Introduction
NetNews is a company which runs an NNTP server carrying the complete USENET news feed with over 15,000 news groups. Access to this server is available to internet users all over the world. Users of the system pay a subscription fee for access. The fee may be paid monthly ($20), half-yearly ($100) or yearly ($180).
A program is required to produce a report showing those subscriptions which are now due. The report will be based on the Due Subscriptions file.
The Due Subscriptions file is a sequential file sorted on ascending CardNumber within ascending PaymentMethod.
The report must be printed on ascending CustomerName within ascending CountryName.
Four items in the report cannot be obtained directly from the Due Subscriptions file;
-
The PaymentMethod field in the Due Subscription file must be converted to its equivalent
string value using the following code assignments :-
1 = VISA, 2 = Access, 3 = AmExpress, 4 = Cheque. - The CountryCode field must be converted to a CountryName
-
The PaymentFrequency field in the Due Subscriptions file must be converted into a
SubscriptionCharge using the following assignments;
1 = $20, 2 = $100, 3 = $180 - When there is an exchange rate for the country, the SubscriptionCharge must be converted to local currency (SubscriptionCharge * ExchangeRate).
The exchange rates, the country codes and their corresponding country names are contained in a sequential Country file. The file is ordered on ascending CountryCode. To allow efficient conversion of the CountryCode to the CountryName and of the SubscriptionCharge to local currency, the Country file must be loaded into a table in memory. There are currently 243 country names in the file.
The Country file contains exchange rates for major currencies only. Where there is no exchange rate for a country there is a zero in the ExchangeRate field. When the exchange rate is 0 a zero must be returned for the local currency subscription charge.
Files
The Country File
The Country File is a sequential file ordered on ascending CountryCode. The record descriptions are shown below;
|
Field |
Type |
Length |
Value |
CountryCode |
X |
2 |
Internet Code |
CountryName |
X |
25 |
- |
ExchangeRate |
9 |
10 |
99999.99999 |
The Due Subscriptions File
The Due Subscriptions file contains details of all customers whose subscription have fallen due. It is a sequential file sorted on ascending CardNumber within ascending PaymentMethod. Records in the file have the following description:
|
Field |
Type |
Length |
Value |
CustomerSurname |
X |
20 |
- |
CustomerInitials |
X |
2 |
- |
PaymentMethod |
9 |
1 |
1/2/3/4 |
PaymentFreq |
9 |
1 |
1/2/3 |
CardNumber |
X |
20 |
- |
ExpiryDate |
9 |
4 |
mmyy |
CountryCode |
X |
2 |
Internet Code |
The Due Subscriptions Report
Numeric values must be printed using comma insertion and either zero suppression or the floating currency symbol. There is no need to worry about controlling the change of page, so no line count need be kept and the headings never have to be printed again.
See the print specification below for more report format details.
| Line 2-6 | Report Heading. To be printed on the first page of the report only. |
| Line 8 |
Customer Details. The CountryName is suppressed after its first
occurrence. The PayMethod is VISA, Access, AmExpress or Cheque. Subs is the subscription charge:- $20, $100 or $180. LC Subs is the subscription charge in local currency. This value is rounded to produce a whole number. Do not precede this value by a dollar sign. It should be zero suppressed and have commas inserted as appropriate. |
| Line 15-18 | Country totals. These are the sum of the dollar subscription charges for customers in this country. |
| Line 32-35 | Final Totals. These are the sum of all the customer dollar subscription charges. |
