Compare Two Files And Get Total Price

Apr 30, 2010 at 10:57am
Hello guys. I have a question as part of an ongoing project I am working on. The final piece of this project involves comparing two files, one with certain part numbers, and the other file with the price of those parts. Basically, you compare the two files and determine the total price of the order.

My only problem is that I cannot figure out how to compare each file, and the parts file is obviously a set of strings, while the price file would be a set of floats. Would you have to somehow convert the strings to floats? I already tried this in my code, but with no luck. Here are the two files:

Order

1
2
3
4
5
6

AAAAC AAAAB AAAAD CCCC5 CCC14 BBBBE BBBBG ABCD4 _BCD5 _BC13 QQQE3 QQQ3R QQQQD ERFG8 ZZZZ4 ZE_B12 PPP14 REWD2
REWWW REWRG REWFG ZZAA0 ZZAA1 AA5E8 YC1AD AALAA ZZABO J4NAA AA5F6 ZZABN ZZABH ZZABI ZZABJ ZZAAU ZZAAS ZZAA3
ZZAAR AAGAX ZZAAG ZZABB J4NAA A9CAB ZZABD ABFAD WANAC ZZABE ABCAA ABCAB ZZAA2 ZZAAW ABFAA ZZAAT YPZAA WANAB
ZZAAJ ZZGAX TR-TC YCMA


Pricing File

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
AAAAC,AAAAB,AAAAD="22.30";
CCCC5,CCC14="15.00";
BBBBE,BBBBG="5.01";
ABCD4,_BCD5,_BC13="6.22";
QQQE3,QQQ3R,QQQQD="7.45";
ERFG8,ZZZZ4="0.50"; 
ZE_B12,PPP14="0.21";
REWD2,REWWW,REWRG,REWFG="0.12";
ZZAA0="1.01";
ZZAA1,AA5E8,YC1AD,AALAA="1.05";
ZZABO,J4NAA,AA5F6="0.99"; 
ZZABN,ZZABH,ZZABI,ZZABJ="0.99";
ZZAAU,ZZAAS,ZZAA3="2.01";
ZZAAR,AAGAX="1.31";
ZZAAG="0.87";
ZZABB,A9CAB="0.43";
ZZABD,ABFAD,WANAC="0.22";
ZZABE,ABCAA,ABCAB,ZZAA2,ZZAAW,ABFAA="0.21";
ZZAAT,YPZAA,WANAB,ZZAAJ="0.11";
ZZGAX,TR-TC,YCMA4="0.09";


I'm guessing possibly my pricing file isn't set up correctly, but I'm not sure how else to compare, unless I open the order file, then convert those strings to floats, then compare each of those floats to the price file, and add them up? Any help is appreciated. This has been driving me mad.
Apr 30, 2010 at 1:00pm
Can you define what you mean by "compare"?
Topic archived. No new replies allowed.