// Program demonstrates method that can be called // with one, two, or three arg
ID: 3545057 • Letter: #
Question
// Program demonstrates method that can be called
// with one, two, or three arguments
// Tuition is $80 per credit
// Default district code is I.
// If student is in-district (code I), then there is no
// out-of-district fee, which is $300
// Default scholarship status is false.
// If student is on scholarship, tuition is free
using System;
class DebugEight3
{
public static void Main()
{
Console.WriteLine("Tuition is {0}", CalculateTuition(15));
Console.WriteLine("Tuition is {0}",CalculateTuition(15, 'O'));
Console.WriteLine("Tuition is {0}",CalculateTuition(15, 'O', true));
}
double public static void (double credits, char code = 'I', bool scholarship)
{
double tuition;
const double RATE = 80.00;
const double OUT_DISTRICT_FEE = 300.00;
tuition = credits * RATE;
if(code != 'I')
tuition += OUTDISTRICTFEE;
if(scholarship)
tuition = 0;
}
}
Explanation / Answer
// Program demonstrates method that can be called
// with one, two, or three arguments
// Tuition is $80 per credit
// Default district code is I.
// If student is in-district (code I), then there is no
// out-of-district fee, which is $300
// Default scholarship status is false.
// If student is on scholarship, tuition is free
using System;
class DebugEight3
{
public static void Main()
{
Console.WriteLine("Tuition is {0}", CalculateTuition(15));
Console.WriteLine("Tuition is {0}",CalculateTuition(15, 'O'));
Console.WriteLine("Tuition is {0}",CalculateTuition(15, 'O', true));
}
public static double CalculateTuition(double credits)
{double tuition;
const double RATE = 80.00;
tuition = credits * RATE;
return tuition;
}
public static double CalculateTuition(double credits, char code)
{
double tuition;
const double RATE = 80.00;
const double OUT_DISTRICT_FEE = 300.00;
tuition = credits * RATE;
if(code != 'I')
tuition += OUT_DISTRICT_FEE;
return tuition;
}
public static double CalculateTuition(double credits, char code , bool scholarship)
{
double tuition;
const double RATE = 80.00;
const double OUT_DISTRICT_FEE = 300.00;
tuition = credits * RATE;
if(code != 'I')
tuition += OUT_DISTRICT_FEE;
if(scholarship)
tuition = 0;
return tuition;
}
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.