Those two words were meant for each other. :cheesy: Anyways, i got the final on Wednesday and it's due next Wednesday.
I have to design a program that takes information from a text document, displays that information, makes calculations based on that information, and then prints those calculations in a separate text document. The document LarryLemon.txt is the record of all cars sold at a used car lot. With each car sold the following variables were recorded in the document: VehiclePrice, LastName$, FirstName$, Phone, Address, City$, State$, ZIP, and Salesperson$.
I have written the following code so far:
'Ananda Bennett
'12/06/06
'Sales program
OPEN "c:\LarryLemon.txt" FOR INPUT AS #1
DO WHILE EOF(#1) <> -1
INPUT #1, VehiclePrice, LastName$, FirstName$, Phone, Address, City$, State$, ZIP, Salesperson$
PRINT "VehiclePrice LastName FirstName Phone Address City State ZIP Salesperson"
PRINT "................................................................................................"
PRINT VehiclePrice; " " ;LastName$; " " ;FirstName$; " " ;Phone; " " ;Address; " " ;City$; " " ;State$; " " ;ZIP; " " ;Salesperson$
PRINT " "
LOOP
CLOSE #1
The code above only displays the information in the LL.txt file. The three calculations that I need to make are totaling how many cars each sales person sold, the total of their sales, and the average cost of a car he or she sold. Along with the sales persons name, the other two calculations need to be sent to a file for each sales person.
In order to count the total of cars sold by each sales person I was going to use the following code:
'i will do this for each sales person
IF Salesperson = Taylor THEN
LET count = count + 1
The following code will print the three calculations that I mentioned above:
LET totalcost = cost + cost
LET avgcost =(totalcost)/count
PRINT " Vehicles sold: ";count
PRINT " Total sales: ";totalcost
PRINT" Average sales: ";avgcost
Now the only thing left to do is print, along with the corresponding sales persons name, the total of their sales, and the average cost of a car he or she sold, in a text document. I pretty much have no idea how to do that. So, if anyone here could give me some insight into this it would be greatly appreciated.
Also, i have no idea if any of the code past the first snip-it works because my PC is in the shop. If someone would run them and let me know which ones work and which ones don't, that too would be greatly appreciated.
Thanks,
Ananda :twisted: