For my next update to my shopping cart calculator, I would like to be able to save the resulting shopping list to a text file. What is the best method for this, in your opinion?
Code: Select all
'Shopping Cart Calcuator v1.3
'A Project for Algebra 1 Class
'By Michael (Blahboybang/Fuzzypig) Reiley
Dim item_name (1 to 1000) as string
Dim item_cost (1 to 1000) as double
Dim sub_total as double
Dim total as double
Dim sales_tax as double
Dim tax_total as double
'Intro
Print "Shopping Cart Calculator v1.3"
sleep 1500
cls
sleep 500
Print "By Michael Reiley"
sleep 1500
cls
sleep 500
'Main
item_num = 1
Input "Sales Tax Percentage in Area : ",sales_tax
sales_tax = sales_tax / 100
cls
mainloop:
Input "Item Name : ",item_name(item_num)
cls
Input "Item Cost : $",item_cost(item_num)
cls
for i = 1 to item_num
if i = 1 then tax_total = item_cost(1) * sales_tax
if i > 1 then tax_total = tax_total + (item_cost(i) * sales_tax)
if i = 1 then sub_total = item_cost(1)
if i > 1 then sub_total = sub_total + item_cost(i)
total = sub_total + tax_total
Print item_name(i) & " : $" & item_cost(i)
next i
item_num = item_num + 1
Print " Sub-Total : $"
c = csrlin
locate c-1, 16
Print using "#############.##"; sub_total
Print " Total : $" & total
c = csrlin
locate c-1, 16
Print using "#############.##"; total
inputhere:
Input "Enter Another Item (y/n)";yn$
cls
if lcase(yn$) = "y" or lcase(yn$) = "yes" then goto mainloop
if lcase(yn$) = "n" or lcase(yn$) = "no" then goto ending
Print "INPUT ERROR"
sleep 1000
cls
goto inputhere
'Ending
ending:
Print "Press Any Key to Exit"
sleep