QUOTE(deedee66 @ 28 Sep, 2008 - 08:28 PM)

QUOTE(vertizor @ 28 Sep, 2008 - 08:17 PM)

I'm not entirely sure what you want this bit of code to do. As it stands, you are instantiating a Rate object with one argument. Your constructor for Rate that takes one argument, first runs the constructor that takes two variables, and this causes a query and gets some input. Then when the 1-argument constructor continues execution, it again queries for some information and takes some input. That's all that happens - at this point cust1 is initialized, with private variable refferrerfLoanAmount set to 0, then your main function ends.
it is suppose to just get input for the loan amount, rate and terms and print out the input
it is suppose to be a exercise in abstract classes.
I'm afraid I still don't entirely understand, but maybe I do have some suggestions. First though - you are passing into your constructors values that look like what you then query the user for. If your passing them in, why query? If your going to query, make them constructors with no arguments. Following that, reasoning,
CODE
public class Loan
{
private float fLoanAmount;
public Loan()
{
Console.WriteLine("Please enter an Loan Amount: ");
//Note that Parse will throw an exception if the read-in value can't convert to a float
this.fLoanAmount = float.Parse(Console.ReadLine());
}
}
If you change your Loan class to this, you will get the query for a Loan amount displayed. A more elegant way to get all 3 displayed would be
CODE
public class Loan
{
private float fLoanAmount;
public Loan()
{
Console.WriteLine("Please enter an Loan Amount: ");
//Note that Parse will throw an exception if the read-in value can't convert to a float
fLoanAmount = float.Parse(Console.ReadLine());
}
}
class Rate : Loan
{
private float referrerfLoanAmount;
//private double dPercentageRate;
public Rate()
{
Console.WriteLine("What is your Percentage Rate ");
string PercentRate;
PercentRate = Console.ReadLine();
double a = double.Parse(PercentRate);
}
class Terms : Rate
{
private double referrerdPercentageRate;
public Terms()
{
Console.WriteLine("What is are your Terms ");
string Terms = Console.ReadLine();
int a = int.Parse(Terms);
}
}
class MyLoan : Rate
{
static void Main(string[] args)
{
Loan cust1 = new Terms();
}
}
}
Note that I changed it so that Terms now extends Rate, as oppose to loan, so that when you make a Terms object it runs the constructors for both Loan and Rate. If this isn't what your assignment wants, you can of course do it however you need.