Posted by: krishnaram March 14, 2009
Login in to Rate this Post:
0
?
Looks like you are not a beginner in C# only, you are new to programming as well...
Here is the final code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace assignement1_nepal
{
public class PhoneCall
{
public double min;
double totalcost;
const double unitcost = 0.10;
public void NumberOfMin()
{
Console.WriteLine(" Enter min:");
min = Convert.ToDouble(Console.ReadLine());
}
public double CalculateCost()
{
totalcost = min * unitcost;
return totalcost;
}
public void Output()
{
Console.WriteLine(" total cost:{0}", totalcost);
}
}
class threecalls
{
static void Main(String[] args)
{
PhoneCall callone = new PhoneCall();
for(int i=0; i<3;i++)
{
callone.NumberOfMin();
callone.Calculatecost();
callone.Output();
}
}
}
}
This should work. Cheers :)
Here is the final code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace assignement1_nepal
{
public class PhoneCall
{
public double min;
double totalcost;
const double unitcost = 0.10;
public void NumberOfMin()
{
Console.WriteLine(" Enter min:");
min = Convert.ToDouble(Console.ReadLine());
}
public double CalculateCost()
{
totalcost = min * unitcost;
return totalcost;
}
public void Output()
{
Console.WriteLine(" total cost:{0}", totalcost);
}
}
class threecalls
{
static void Main(String[] args)
{
PhoneCall callone = new PhoneCall();
for(int i=0; i<3;i++)
{
callone.NumberOfMin();
callone.Calculatecost();
callone.Output();
}
}
}
}
This should work. Cheers :)