Code/meal.csv
dinner,vegetable sushi,6 rolls,$3.50
dinner,tuna roll,3 rolls,$4.50
dinner,roe, 2 rolls,$3.95
lunch,bento box a - chicken teriyaki,box combo,$8.59
using System;
namespace FileIOManager
{
static class FileLocation
{
public const string INPUT_FILE = "../../Data/meals.csv";
}
}
using System;
using System.IO;
namespace FileIOManager
{
static public class FileReader
{
private static int GetLineCount()
{
StreamReader sr = new StreamReader(FileLocation.INPUT_FILE);
int counter = 0;
while (!sr.EndOfStream)
{
counter++;
sr.ReadLine();
}
sr.Close();
return counter;
}
public static string[] ReadLines()
{
int totalItems = GetLineCount();
string[] itemDetails = new
string[totalItems];
StreamReader sr = new StreamReader(FileLocation.INPUT_FILE);
string itemDetail;
int counter = 0;
while
(!sr.EndOfStream){
itemDetail = sr.ReadLine();
if
(itemDetail.Trim() != "")
itemDetails[counter++] =
itemDetail;
}
sr.Close();
return
itemDetails;
}
}
Bryian TanPosted Sep 22, 2010, 11:40 PM
to display the output, replace these lines
To
David ChenPosted Sep 24, 2010, 12:47 AM
Bryian TanPosted Sep 23, 2010, 11:44 PM
What you have so far? Show me your codes.
David ChenPosted Sep 23, 2010, 12:26 AM
the price actually needed to times by 1.8 so Price = Cost * 1.8
also i'll be dealing with bubble sort.. which I have never learn to knew how to coz we have ot make it look like this in the end
* Lunch Items *
$15.46 bento box a - chicken teriyaki, box combo
$17.26 bento box b – sashimi, box combo
* Dinner Items *
$7.11 roe, 2 rolls
$8.10 tuna roll, 3 rolls
$6.30 vegetable sushi, 6 rollsThanks again for your time off
David
Bryian TanPosted Sep 23, 2010, 12:15 AM
David ChenPosted Sep 22, 2010, 11:42 PM