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:

Attachments
15512.00,Jones,Jack,111-222-3333,123 Main,Aberdeen,CA,10001,Smith
41237.00,Sanchez,Paul,111-444-9999,777 Oak,Aberdeen,CA,10001,Smith
52789.00,Price,Phillip,213-199-2599,848 Oxford Way,Aberdeen,CA,10001,Smith
12374.00,Mitchell,Nadine,213-023-5222,2581 Jackson Avenue,Aberdeen,CA,10001,Smith
4124.00,Johnson,Audrey,213-939-9931,805 Sherwood Lane,Aberdeen,CA,10001,Smith
78275.00,Martin,Wallace,213-796-6079,2481 Volunteer Drive,Aberdeen,CA,10001,Smith
72474.00,Nichols,James,213-236-3762,4761 Greensburg Street,Aberdeen,CA,10001,Smith
62621.00,Gaines,Ernest,213-431-0404,6866 Riverside Avenue,Aberdeen,CA,10001,Smith
20413.00,Sharp,Scott,213-579-9244,2279 Crosby Drive,Albany,NY,10002,Smith
65014.00,Knight,Trina,213-584-2611,8350 Lake Terrace Drive,Albany,NY,10002,Smith
26481.00,Lindsey,Daphne,213-577-3340,2007 Berrywood Drive,Albany,NY,10002,Smith
32145.00,James,Brandy,213-324-3106,5489 Church Street,Albany,NY,10002,Smith
6512.00,Davis,Duane,213-064-3591,1185 Meadowlake Drive,Algonquin,CA,10702,Smith
45612.00,Moore,Vivian,213-575-9359,5983 Prince Street,Algonquin,CA,10702,Smith
38969.48,James,Richard,805-912-2014,5319 Deer Park Lane,Algonquin,CA,10702,Smith
39064.62,Jernigan,Kristen,213-663-5967,606 Front Street,Alliance,KY,10960,Elobrah
39159.76,Mitchell,Courtney,213-039-0832,2300 River Street,Alliance,KY,10960,Elobrah
39254.91,Baez,Agnes,213-000-8669,7438 Brookview Drive,Alliance,KY,10960,Elobrah
39350.05,Baez,Charlotte,213-547-0811,4880 Buchanan Circle,Alliance,KY,10960,Elobrah
39445.19,Hinton,Vicky,213-937-5625,7247 84th Avenue,Alliance,KY,10960,Elobrah
39540.33,Price,Eric,213-818-2892,7668 Sanders Ferry Road,Alliance,KY,10960,Williamson
39635.47,Mann,Eugene,213-628-5521,1232 Sunset Place,Amarillo,TX,11010,Williamson
39730.61,Howe,Greg,213-751-8051,5183 Meadowlake Drive,Amarillo,TX,11010,Williamson
39825.75,Holder,Carly,213-382-2207,167 Stillhouse Road,Amarillo,TX,11010,Williamson
39920.89,Hardcastle,Madison,213-408-3664,6305 Buchanan Circle,Amarillo,TX,11010,Williamson
40016.03,Hammer,Malcolm,213-879-5925,7936 West Ridge Drive,Amarillo,TX,11010,Williamson
40111.17,McDougal,Earl,213-179-6701,5995 Windy Hill Road,Amarillo,TX,11010,Williamson
40206.31,Shepherd,Andy,213-702-2588,458 Montgomery Drive,Amarillo,TX,11010,Williamson
40301.45,Guthrie,Thad,213-867-4450,2717 Hillsdale Drive,Amarillo,TX,11010,Williamson
40396.59,Rich,Manuel,312-368-9094,7940 N. Main Street,Anchorage,AK,11756,Williamson
40491.73,Vance,Dominic,213-777-9248,3408 Jackson Avenue,Anchorage,AK,11756,Williamson
15512.00,Killen,Anthony,213-374-8241,4113 Butler Road,Anchorage,AK,11756,Williamson
41237.00,Logan,Leslie,213-319-3812,4323 Hazelwood Drive,Anchorage,AK,11756,Williamson
52789.00,James,Jesus,213-366-0135,98 Roberts Road,Anchorage,AK,11756,Williamson
12374.00,Olson,Sharon,213-687-2602,4862 Elm Street,Ankeny,IO,34567,Williamson
4124.00,McCain,Vicky,213-340-8769,6949 84th Avenue,Ankeny,IO,34567,Williamson
78275.00,Sparks,Audrey,213-096-4697,1507 Horseshoe Road,Ankeny,IO,34567,Williamson
72474.00,Proctor,Sharon,213-883-2405,7953 Virginia Street,Ankeny,IO,34567,Williamson
62621.00,Adkins,Tom,213-626-4583,4465 Morningside Drive,Ankeny,IO,34567,Coleman
20413.00,Guerra,Leslie,213-944-3167,4136 Riverside Avenue,Ankeny,IO,34567,Coleman
65014.00,McKinney,Chan,213-351-8886,8808 Cline Avenue,Ankeny,IO,34567,Coleman
26481.00,Lyons,Gaylen,213-382-7209,3918 12th Avenue,Ankeny,IO,34567,Coleman
32145.00,Doker,Wilma,213-847-3011,7985 River Street,Ankeny,IO,34567,Coleman
6512.00,Runner,Raquel,213-917-9118,4643 Rolling Acres Drive,Ankeny,IO,34567,Coleman
45612.00,Abrams,Shermanda,213-873-4514,8488 Springhill Avenue,Arlington,VA,12301,Coleman
38969.48,Walker,Beth,213-026-3337,7125 Meadow Lane,Arlington,VA,12301,Coleman
42013.98,Mayhew,Ed,213-686-6554,535 Virginia Street,Arlington,VA,12301,Coleman
42109.13,Aldrich,Archie,213-186-7974,4327 Jackson Avenue,Arlington,VA,12301,Coleman
42204.27,O'Connor,Lidia,213-605-7613,5036 Circle Drive,Arlington,VA,12301,Coleman
42299.41,Shigeta,June,213-537-9387,8704 Troon Court,Arlington,VA,12301,Coleman
42394.55,Gray,Archie,213-297-7509,8020 Riverside Avenue,Arlington,VA,12301,Coleman
42489.69,Roberts,Natasha,213-740-2826,6766 Sterling Road,Arlington,VA,12301,Coleman
15512.00,Drake,Maureen,213-144-6397,5175 Front Street,Arlington,VA,12301,Coleman
41237.00,Fisher,Kristen,213-304-6238,668 Kennedy Drive,Arlington,VA,12301,Coleman
52789.00,Jones,Audrey,213-370-1078,1478 Countrywood Drive,Arlington,VA,12301,Coleman
12374.00,Murphy,Amy,213-878-4272,4045 Oxford Way,Arlington,VA,12301,Coleman
4124.00,Perkins,Glen,213-991-8954,6091 Carrington Road,Atlanta,GA,13902,Coleman
78275.00,Dennison,Lena,213-494-9501,7453 College Street,Atlanta,GA,13902,Coleman
72474.00,Clark,Gladys,213-314-5418,3631 Shakertown Road,Atlanta,GA,13902,Coleman
62621.00,Massey,Ashley,213-498-8015,1202 Pleasant Valley Drive,Atlanta,GA,13902,Coleman
20413.00,Hardcastle,Gene,213-412-5253,3185 Highland Court,Atlanta,GA,13902,Coleman
65014.00,Keaton,Gordon,213-489-6936,4991 Pine Branch Trace,Atlanta,GA,13902,Taylor
26481.00,Duncan,Faye,213-157-7646,7595 Virginia Street,Atlanta,GA,13902,Taylor
32145.00,Roberts,Dallas,213-408-8876,1907 Fairways Drive,Atlanta,GA,13902,Taylor
6512.00,Valdez,Searoba,213-578-9083,4056 Dusty Lane,Atlanta,GA,13902,Taylor
45612.00,McPherson,Clarence,213-436-5989,7651 Kennedy Drive,Atlanta,GA,13902,Taylor
38969.48,Yamaguchi,Dewey,213-951-8463,9004 Elm Hill Circle,Atlanta,GA,13902,Taylor
72474.00,Kinser,Audrey,213-871-3797,2885 24th Street,Atlanta,GA,13902,Taylor
62621.00,Ford,Courtney,213-479-6835,8124 Industrial Drive,Atlanta,GA,13902,Taylor
20413.00,Dennison,Lester,213-497-3071,1826 Longview Drive,Atlanta,GA,13902,Taylor
65014.00,Gregory,Horace,213-830-6261,5198 Humble Avenue,Atlanta,GA,13902,Taylor
15512.00,Kelly,Emanuel,213-027-1897,6392 Pleasant Ridge Road,Atlanta,GA,13902,Taylor
41237.00,Cunningham,Darrin,213-707-6528,5034 Lakeside Avenue,Avon Lake,NY,14617,Taylor
52789.00,Huffman,Damon,213-854-2571,3984 Wildwood Street,Avon Lake,NY,14617,Taylor
12374.00,Reeves,Esperanza,213-876-6441,3153 Jackson Avenue,Avon Lake,NY,14617,Taylor
4124.00,McCartney,Henry,213-265-8504,7554 Breckinridge Street,Avon Lake,NY,14617,Taylor
78275.00,Love,Simon,213-019-5484,1519 Tick Ridge Road,Avon Lake,NY,14617,Taylor
72474.00,Hinton,Claudia,213-031-9869,4446 Deer Park Lane,Avon Lake,NY,14617,Taylor
62621.00,Islas,Leon,213-055-6587,5315 Saddlebrook Way,Avon Lake,NY,14617,Taylor
20413.00,Pruitt,Adrian,213-085-0948,1636 125th Avenue,Avon Lake,NY,14617,Taylor
65014.00,Guzman,Archie,213-293-5899,1079 Happy Hollow Road,Avon Lake,NY,14617,Taylor
26481.00,Glass,Jeff,213-723-5024,7030 Halltown Road,Avon Lake,NY,14617,Taylor
32145.00,Rice,Candy,213-443-8479,1051 Prince Street,Avon Lake,NY,14617,Taylor
6512.00,Hoffman,Shannon,213-113-3624,3452 Happy Hollow Road,Avon Lake,NY,14617,Taylor
45612.00,Fields,Arianne,213-379-6542,6749 Gin Still Lane,Avon Lake,NY,14617,Taylor
38969.48,Xiong,Charlotte,213-040-6761,3201 Brown Street,Avon Lake,NY,14617,Taylor
15512.00,Piper,Andrew,213-439-3385,3830 Executive Park Drive,Avon Lake,NY,14617,Orlovski
41237.00,Froedge,Scott,213-750-9313,3311 Sequoia Lane,Avon Lake,NY,14617,Orlovski
52789.00,Elliott,Dennis,202-635-4168,1702 Hilltop Road,Avon Lake,NY,14617,Reddick
12374.00,Johns,Ashley,213-259-9471,2868 15th Street,Avon Lake,NY,14617,Vick
4124.00,Harris,Jewell,213-943-6249,7772 Saddlebrook Way,Bayonet Point,AZ,15219,Vick
78275.00,Rush,Virginia,213-986-4407,634 Oak Street,Bayonet Point,AZ,15219,Vick
72474.00,McFarland,Elizabeth,213-947-3124,7187 Johnson Drive,Bayonet Point,AZ,15219,Vick
62621.00,Key,Leslie,213-621-0416,6850 Smallhouse Road,Bayonet Point,AZ,15219,Dupree
20413.00,Groce,Howard,213-047-1604,1862 Virginia Street,Bayonet Point,AZ,15219,Dupree
65014.00,Doker,Harlen,213-462-4537,6016 Pleasant Ridge Road,Bayonet Point,AZ,15219,Dupree
26481.00,Tabor,Alvin,213-043-6705,2502 Peterson Avenue,Bayonet Point,AZ,15219,Dupree
32145.00,Ross,Vicky,213-583-3095,8061 Butler Road,Bayonet Point,AZ,15219,Dupree
6512.00,James,Helen,202-504-3745,3154 Cairo Road,Bayonet Point,AZ,15219,Dupree
45612.00,Holder,Gordon,213-380-9871,7223 Apple Blossom Road,Bayonet Point,AZ,15219,Dupree
38969.48,Neely,Allen,312-034-3632,6112 Center Street,Plano,TX,16301,Dupree
47246.72,Cardwell,Elizabeth,312-415-1098,1515 Cherry Street,Plano,TX,16301,Dupree
47341.86,Piper,Christa,213-730-5371,886 Deer Park Lane,Plano,TX,16301,Dupree
47437.00,Soy,Eugene,213-158-4620,6332 Girkin Road,Plano,TX,16301,Dupree
47532.14,Mann,Daphne,213-702-9354,2781 Happy Hollow Road,Plano,TX,16301,Dupree
47627.28,Ball,Pierre,213-348-4262,7853 Chestnut Street,Plano,TX,16301,Dupree
47722.42,Jenkins,Basil,213-415-8097,7752 Pebble Creek Drive,Plano,TX,16301,Dupree
15512.00,Jernigan,Leslie,213-120-8406,4431 Oak Street,Berkeley,CA,19013,Dupree
41237.00,Ramsey,Connie,213-650-7829,499 Dixie Way,Berkeley,CA,19013,Dupree
52789.00,Davis,Amos,213-772-2575,3728 Longview Drive,Berkeley,CA,19013,Dupree
12374.00,White,Buck,312-613-5654,62 Green Ridge Road,Berkeley,CA,19013,Dupree
4124.00,Freeman,Scott,213-058-7957,5098 Choctaw Way,Berkeley,CA,19013,Dupree
78275.00,Ervin,Jody,213-492-8404,1638 Countrywood Drive,Berkeley,CA,19013,Dupree
72474.00,Renfrow,Gina,213-969-9765,5078 Main Street,Berkeley,CA,19013,Dupree
62621.00,Shannon,Marshall,213-278-1259,4762 Southern Hills Court,Berkeley,CA,19013,Dupree
20413.00,Baldwin,Orville,805-174-5475,8899 Green Street,Berkeley,CA,19013,Dupree
65014.00,Aldrich,Hank,213-759-8152,8312 Tulip Drive,Berkeley,CA,19013,Dupree
26481.00,Bowe,Hugh,213-467-0607,2253 Park Street,Berkeley,CA,19013,Dupree
32145.00,Kelly,Dwight,312-535-7719,8822 Tick Ridge Road,Berkeley,CA,19013,Cohen
6512.00,Love,Audrey,213-894-6641,7712 Johnson Drive,Berkeley,CA,19013,Collins
45612.00,Killen,Cal,213-706-9724,6722 Mason Court,Berkeley,CA,19013,Collins
38969.48,Neal,Taylor,213-009-2997,6013 Club Circle,Berkeley,CA,19013,Collins
49244.67,Gilbert,Jack,213-193-9396,958 Lakeside Avenue,Berkeley,CA,19013,Collins
49339.82,Keen,Elmer,213-831-0892,3920 84th Avenue,Berkeley,CA,19013,Collins
49434.96,Davis,Bart,213-656-1227,3118 Hazelwood Drive,Berkeley,CA,19013,Collins
15512.00,Adkins,April,213-376-8484,3513 Jackson Avenue,Berkeley,CA,19013,Collins
41237.00,Goad,An

Hi,

I'am giving u the most simplest way of doing this.
Place 1 ListBox on the Form say lstSMan
Check Property, Sorted = False
Clear lstSMan.
Assuming U have Opened the File and u r in a loop.
u have populated the variable SalesPerson.
write this code inside the loop.

lstSMan.Clear
'Open file
'Do
lstSMan.Text = SalesPerson
If lstSMan.SelCount = 0 Then
    lstSMan.AddItem SalesPerson
    lstSMan.ItemData(lstSMan.NewIndex) = 0
    lstSMan.Selected(lstSMan.NewIndex) = True
End If
lstSMan.ItemData(lstSMan.ListIndex) =lstSMan.ItemData(lstSMan.ListIndex)  +1
 
'Write Loop Condition
'Do Any Other Coding here
 
So as per the above code, after the loop, lstSMan Consists of All the SalesPersons and their corresponding Counter is in their ItemData Property, use this code to print.
 
Dim i As Integer
For i = 0 To lstSMan.ListCount-1
    Debug.Print lstSMan.List(i) & "    " & lstSMan.ItemData(i)
Next

I hope it is clear. if u have problems, let me know.

Regards
Veena

QVeen72, you've been asked multiple times to use code tags. Is there a problem with understanding what they are? How to use them? Where to get the information? All this has been mentioned... Check the post at the top if the forum labled Please use BB Code and Inlinecode tags

QVeen72, you've been asked multiple times to use code tags. Is there a problem with understanding what they are? How to use them? Where to get the information? All this has been mentioned... Check the post at the top if the forum labled Please use BB Code and Inlinecode tags

Thank you for posting that. I'm new to programing so when I read QueenV's response I thought either there was something wrong with me or i just wasn't geek enough yet to understand it. :p

Thanks again,

Ananda :twisted:

This article has been dead for over six months. Start a new discussion instead.