Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Explain exothermic and endothermic reactions with examples

Answered: 1 week ago

Question

Write a short note on rancidity and corrosiveness.

Answered: 1 week ago