Followers

Tuesday, March 6, 2012

EMY'S DAILY PROJECT LOG - week 4

March 05, 2012 (Mon)
* Continued work on writing research summary paper
- How ERP / MRP / MRP II related to production planning

March 06, 2012 (Tue)
* Finish last week report and submit
- further reads on Issues or problems in Production planning/manufacturing processes

March 07, 2012 (Wed)
* Search the solution of any error during using TextReader and TextWriter in C#.
- A code in TextReader and TextWritter in C# is show below. Author has referred to csharp-station.com as reference in converted old assignment to C#.
* Continued work on convert the old assignment (Hotel Management) to C#

TextWritter and Streamwriter in C#

Console.Write(" \n Room Number [1 ---->> 10]: ");
int room = int.Parse(Console.ReadLine());

if (room == 1)

{
/*create a writer and open the file.This program creates a text file when it runs. In the directory where the executable program is located,*/

TextWriter tw = new StreamWriter("a.txt");

// write a line of text to the file

tw.WriteLine("" + name);
tw.WriteLine("" + ic);
tw.WriteLine("" + balance);

// close the stream
tw.Close();

}
if (room == 2)
{

TextWriter tw = new StreamWriter("b.txt");
tw.WriteLine("" + name);
tw.WriteLine("" + ic);
tw.WriteLine("" + balance);
tw.Close();

}
if (room == 3)
{

TextWriter tw = new StreamWriter("c.txt");
tw.WriteLine("" + name);
tw.WriteLine("" + ic);
tw.WriteLine("" + balance);
tw.Close();

}
TextReader and StreamReader in C#

case 'b':
{

Console.ReadLine();
Console.Write(" Enter user's room number [1 --->> 10]: ");
int numroom1 = int.Parse(Console.ReadLine());
Console.WriteLine();

if (numroom1 ==1)
{

StreamReader tr = File.OpenText("a.txt");

string name1, ic1, balance1 = null;

while ((name1 = tr.ReadLine()) != null)

while ((ic1 = tr.ReadLine()) != null)

while ((balance1 = tr.ReadLine()) != null)

{

Console.WriteLine(" Customer name : " + name1);

Console.WriteLine(" IC number : " + ic1);

Console.WriteLine(" Balance to pay: " + balance1);

Console.ReadLine();

}

tr.Close();

}


if (numroom1 == 2)

{

StreamReader tr = File.OpenText("b.txt");

string name1, ic1, balance1 = null;

while ((name1 = tr.ReadLine()) != null)

while ((ic1 = tr.ReadLine()) != null)

while ((balance1 = tr.ReadLine()) != null)

{

Console.WriteLine(" Customer name : " + name1);

Console.WriteLine(" IC number : " + ic1);

Console.WriteLine(" Balance to pay: " + balance1);

Console.ReadLine();

}

tr.Close();


}


if (numroom1 == 3)

{

StreamReader tr = File.OpenText("c.txt");
string name1, ic1, balance1 = null;
while ((name1 = tr.ReadLine()) != null)
while ((ic1 = tr.ReadLine()) != null)
while ((balance1 = tr.ReadLine()) != null)

{
Console.WriteLine(" Customer name : " + name1);
Console.WriteLine(" IC number : " + ic1);
Console.WriteLine(" Balance to pay: " + balance1);
Console.ReadLine();

}
tr.Close();
}

March 08, 2012 (Thur)
* make calculation on total price, balance to pay.
* also try convert to window form in C#

March 09, 2012 (Fri)
* find out why the data can't display when check out
- just need to add "Console.ReadLine()" after the codes (choose case 'b'), and the codes is before the users enter the room's number
* Finished converted old assignment to C#

No comments:

Post a Comment