Steve  Miles

Steve Miles

  • NA
  • 5
  • 9.7k

this is a question about arrays and methods

Apr 21 2015 7:56 AM

A menu driven program is required that will allow the user either produce a sales report on the console, search a sales file do some data analysis. The program will take its input from the comma delimited sequential file “sales.dat” with the record structure outlined below.

 I am trying to do this program without using classes as i am not that advanced yet to use them so it is just mainly methods with FileStreamer to read in the txt file to share across the methods. 

SALES.TXT record structure

Field Name

Type

salesPersonNumber

Integer

salesPersonName

String

totalSales

Double

This is an example of its contents:

1,Pat Ryan,280

2,Mary Smith,300

3,Tom Lynch,20


Menu Format

Menu

1. Sales Report

2. Search for a Salesperson

3. Sale Analysis

4. Exit

The user shall be able to create report, search and do sale analysis as often as they like. The program will terminate when exit is selected.

Sales Report

The report will have the format and contents as outlined below.

For each salesperson your program will calculate the commission due using the criteria in Table 1.

Table 1

Sale amount

Commission

Less than 1000

5%

Between 1000 and 1999

10%

Between 2000 and 2999

15%

Greater than 2999

20%

Example report for the sample data file

Sales Report

Salesperson number Name Sales commission

1 P.R 280.00 14.00

2 M.S. 300.00 15.00

3 T.L 20.00 1.00

Total Sales €600.00

Average Sales €200.00

Total Commission €30.00

Average Commission €10.00

Top SalesPerson 2

End-of-Report

Search

Allow the user enter a player number, the program will then search the file, and display the players name, and the score for chosen player. If the player is not found display a message stating “No match found”.

Example dialogue

Enter Salesperson Number: 2

Name : Mary Smith

Sales : 300

Sales Analysis

A report showing the number of salespeople that sell in the above ranges is required. Use an array to store the number in each range.

Range Number in this range

0-399 3

400-599 0

600-699 0

700-999 0

1000 and over 0