Question
Your Assignment: This code is written in C#. Please correct this code so that it compiles and runs. This program contains 4 errors! Don't just
Your Assignment: This code is written in C#. Please correct this code so that it compiles and runs. This program contains 4 errors! Don't just correct the code but ALSO EXPLAIN WHAT YOU FIXED AND WHY!!
namespace DailyRate
{
class Program
{
static void Main(string[] args)
{
(new Program()).run();
}
void run()
{
double dailyRate = readDouble("Enter your daily rate: ");
int noOfDays = readInt("Enter the number of days: ");
writeFee(calculateFee(dailyRate, noOfDays));
}
private void writeFee(double p, int n)
{
Console.WriteLine("The consultant's fee is: {0}", p * 1.1);
}
private double calculateFee(double dailyRate, int noOfDays);
{
return dailyRate * noOfDays;
}
private double readInt(string p)
{
Console.Write(p);
string line = Console.ReadLine();
return int.Parse(line);
}
private double readDouble(int p)
{
Console.Write(p);
string line = Console.ReadLine();
return double.Parse(line);
}
}
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started