Click here to Skip to main content
15,877,618 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Consider the following program below.

C#
namespace ConsoleApplication35
{
class OvLoading
{
public string message = "Default message.";
public OvLoading()
{
Console.WriteLine("Hello from C#.");
}
public OvLoading(string message)
{
Console.WriteLine (message);
}
public int Add(int a, int b)
{
int x;
return x = a + b;
}
public int Add(int a, int b, int c)
{
int y;
return y = a + b + c;
}

IT Dip Programmin 3B Page 4 of 6 2nd Semester 2018 Individual Assignment
Memo ver.
© Damelin
C#
public double Add(double a, double b)
{
double u;
return u = a + b;
}
public float Add(float a, float b, float c)
{
float v;
return v = a + b + c;
}
}
class hub
{
public static void Main(String[] args)
{
OvLoading…… (2 marks)
OvLoading ….. (2 marks)
Console.WriteLine("…………………." + ???.???(………….)) (2 marks)
Console.WriteLine("…………………." + ???.???(………….)) (2 marks)
Console.WriteLine("…………………." + ???.???(………….)) (2 marks)
Console.WriteLine("…………………." + ???.???(………….)) (3 marks)
Console.ReadLine();
}
}
}

Result:
Hello from C#.
This is form the constructor with one parameter
Addition of two integers gives: 7
Addition of two double type values gives: 0.9
Addition of three integers gives: 12
Addition of three float type values gives : 1.5

What I have tried:

I'm honestly confused I tried researching but that didn't help. please show me the issue here.
Posted
Updated 13-Aug-18 7:58am
v3

We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Try it yourself, you may find it is not as difficult as you think!

If you meet a specific problem, then please ask about that and we will do our best to help. But we aren't going to do it all for you!
 
Share this answer
 
Comments
CodeWraith 13-Aug-18 9:44am    
You could have told him that the code in the Main() function would not compile as it is. He does not need to add any new lines, but he has to complete the existing lines in such a way that it would compile and running the program would produce the given output. He mostly has to deduce the right parameters for the calls to do that.
OriginalGriff 13-Aug-18 10:02am    
It won't compile because it's lost it;'s formatted when he copied and pasted his homework in as a question, so it looks odd.

And he's posting all his homework here, I suspect - he has another in the system - so "honestly confused" translates to "can't be bothered" I think...
CodeWraith 13-Aug-18 10:13am    
Maybe. I told him that he should take a good look at the Main() function and figure out what to pass to the constructors and functions. As they say in Texas: You can bring a horse to the water, but you can't drink for it.
I agree that we should not do your homework for you, but if your question is about how to go about solving this problem, then this may help:

Look at the Main() function. It would not compile as it is and therefore it can't be execute. You don't have to add any new lines. Your job is to complete the given lines in such a way that the program compiles and produces the given output. The constructors and functions to call are already there. Now you must just figure out what parameters are to be passed and set the syntax right to make it work.

Good luck.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900