Here is my code but I am having an error saying that Convert is not declared and the code is not working. What did I do wrong, please?
Here is my code but I am having an error saying that Convert is not declared and the code is not working. What did I do wrong, please?
Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter11: More Object-oriented Programming Concepts
Section: Chapter Questions
Problem 10PE
Related questions
Question
100%
Microsoft Visual C# 7th Edition
Instruction: DebugEight3.cs has syntax and/or logical errors. Determine the problem(s), and fix the program .
Here is my code but I am having an error saying that Convert is not declared and the code is not working. What did I do wrong, please?
// 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 static System.Console;
class DebugEight3
{
static void Main()
{
double credits;
char code='I';
bool isScholarship=false;
string numCredit;
WriteLine("Enter number of credit");
numCredit = ReadLine();
credits = Convert.ToDouble(numCredit);
double tuition;
tuition=CalculateTuition(credits,code, isScholarship);
WriteLine("Tuition is {0}", CalculateTuition(credits,code, isScholarship));
WriteLine("Tuition is {0}", CalculateTuition(credits,code, isScholarship));
WriteLine("Tuition is {0}", CalculateTuition(credits, code, isScholarship));
}
public static double CalculateTuition(double credits, char code, bool scholarship)
{
bool isScholarship=false;
double tuition;
const double RATE = 80.00;
const double OUT_DISTRICT_FEE = 300.00;
tuition = credits * RATE;
if(code != 'I')
tuition += OUT_DISTRICT_FEE;
else
tuition=credits * RATE;
if(isScholarship)
{tuition = 0;
isScholarship=true;}
return tuition;
}
}
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781305480537
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,