reading textfile

For some reason my program is producing no output. What am I doing wrong.
This is the problem- https://www.pdf.investintech.com/preview/6e7a07be-da24-11e7-9f8d-0cc47a792c0a/index.html

This is my code.

 
  



textfile is
8043 3 1 4
3 2
4 1
8047 2 2 3
3 1
8055 4 1 2
2 5
3 1
4 4
8060 1 4 12
8063 2 3 5
4 9
8068 1 2 10
8071 2 2 8
4 5
8078 3 1 21
3 4
4 13
8083 4 1 10
2 13
3 7
4 1
8085 1 2 6
8087 3 2 5
3 2
4 9
8092 3 1 2
2 4
4 3
8095 4 1 2
2 2
3 5
4 1
8097 1 3 15
8099 3 1 4
2 8
3 10
8101 3 2 3
3 8
4 5
8103 2 3 11
4 6
8105 1 4 22
8109 3 2 19
3 1
4 1
8112 2 2 4
3 8
8115 4 1 8
2 10
3 12
4 4
8118 1 1 1
8120 2 2 5
4 11
8125 3 1 7
2 18
3 4
Last edited on
It works for me. I compiled and ran the above code, with the supplied data in the input file "Junkyard.txt", and it produced a couple of pages of output, starting with
Welcome to Luxury Junkyard, Inc. the end of month report
-----------------------------------------------------
CURRENT SELLING PRICES
-----------------------
AUDI      8876.50
BMW       9909.89
JAGUAR   10999.99
LEXUS     7776.69

followed by nearly 60 completely blank lines, then a lot of output looking like this:
SALESPERSON ID      MODEL DESCRIPTION     COUNT SOLD      TOTAL SOLD $$$ PER MODEL
   8043                     Audi                 4               26629.50
SALESPERSON ID      MODEL DESCRIPTION     COUNT SOLD      TOTAL SOLD $$$ PER MODEL
   8047                     BMW                  3               19819.78
SALESPERSON ID      MODEL DESCRIPTION     COUNT SOLD      TOTAL SOLD $$$ PER MODEL
   8055                     Audi                 2               35506.00
SALESPERSON ID      MODEL DESCRIPTION     COUNT SOLD      TOTAL SOLD $$$ PER MODEL
   8060                     Lexus               12                7776.69
... and more ...
Last edited on
Hello cash,

Are you sure there is something in the file to read?

It worked when I showed it to you.

The "Report" function is lacking the code to dealwith multiple sales for an ID.

Andy
Topic archived. No new replies allowed.