My current program is: //CD store sales maintain - title catalogue each week.
/* - ask best selling CD, number sold, - ask particular CD - ask total sales
- 20 CDs, cat num 0-19,
- sales stored sales.txt - sales ordered cat num - all figures greater 0
- 1. reads sales fig form .txt then answeres questions above
*/
public class CdStore {
int sale; int tSale; int catNum[] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19};
public CdStore(int sale){
}
}
The problems is:
The organisers of a CD store want to maintain the sales figures for each CD title in their catalogue. Each week, the manager would like to be able to ask for the best selling CD and the number of copies sold, or the sales for a particular CD, or the total sales. There are 20 CDs. Each CD has a catalogue number from 0 to 19. The sales figures for last week for each CD are stored in a text file sales.txt where each CD's sales figure is written on a separate line. The sales figures are ordered by the catalogue number of the CD, so the figure for CD 0 is first, followed by the figure for CD 1, and so on. The figure for CD 19 is last. Each figure is an integer. All figures are greater than 0.
Write a program which reads the sales figures from the text file, and then allows the user to ask questions as described above, and be given the correct answers. Make sure the user is able to quit cleanly. You should use an array to store the figures, and have separate methods to answer the questions. You can either do all of this in one class with a main method, or using two classes. You should test your program to make sure it is working properly, and answers the questions correctly. You do not need to create separate objects for each CD title.