[Show all top banners]

redlotus
Replies to this thread:

More by redlotus
What people are reading
Subscribers
Subscribers
[Total Subscribers 1]

Rolemodel
:: Subscribe
Back to: Kurakani General Refresh page to view new replies
 c# problem pls help
[VIEWED 6877 TIMES]
SAVE! for ease of future access.
Posted on 04-27-10 2:11 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Develop a C# console application using four overloaded methods that will return the difference of two parameters in each case. Your methods should contain the logic to return the difference of the larger parameter – smaller parameter, regardless of parameter order. Be sure to test all four methods using different sets of input to ensure that the correct results are returned.

Parm 1 Type

Parm 2 Type

Return Type

int

int

Int

double

double

double

int

double

double

double

int

double

The output might look similar to this:

The difference of 30 and 34 is: 4
The difference of 27.35 and 37.70 is: 10.35
The difference of 31 and 37.40 is: 6.4
The difference of 24.28 and 34 is: 9.72
Press any key to continue . . .


 
Posted on 04-27-10 3:37 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 


Hi Red, here is solution add some more codes.


 


using System;


public class Exercise


{


// first


static int first(int a, int b)


{


return a - b ;


}


// second


static double second(double x, double y)


{


return x - y;


}


static int Main()


{


int a, b;


double x, y;


Console.WriteLine("Enter int, int only");


Console.Write("a: ");


a = int.Parse(Console.ReadLine());


Console.Write("b: ");


b = int.Parse(Console.ReadLine());


Console.WriteLine("\nint result " +


"regard : ");


Console.WriteLine("Int = {0}mm", first(a, b));


Console.WriteLine();


Console.WriteLine("Enter double, double only");


Console.Write("x: ");


x = double.Parse(Console.ReadLine());


Console.Write("y: ");


y = double.Parse(Console.ReadLine());


Console.WriteLine("\ndouble result " +


"regard : ");


Console.WriteLine("double = {0}mm",


second(x, y));


Console.WriteLine();


return 0;


}


}


Delta


 


Please Log in! to be able to reply! If you don't have a login, please register here.

YOU CAN ALSO



IN ORDER TO POST!




Within last 200 days
Recommended Popular Threads Controvertial Threads
ANA and AJAY KUMAR DEV. RAPISTS CONVENTION
TPS To F-1 COS
TPS to F1 Status.
Nepal TPS has been Extended !!!
legal Query for married nepali girl now have taken US citizenship
Got my F1 reinstatement approved within 3 months(was out of F1 for almost 2 years)
2020 : Why No Trump !
#MAGA#FAFO is delicious
TPS of Nepal to be automatically extended for 6 months based on South Sudan decision
Democrat lies revealed
Nepal TPS decision
Has anyone here successfully reinstated to F-1 status after a year-long gap following a drop from F-1?
TPS Sakiyo Tara Case is in Court.
Medication from Nepal to USA
Supreme Court allows Trump to end TPS for Venezuelans
Genuine Question.... Why so many folks still in TPS after 10 years. Is the statistics wrong?
Business Ideas in Nepal?
Any input on remote jobs(IT related or Sales or Marketing)?
Nepal Likely to Get 60-Day TPS Notice
TPS cancel bho bhane k garne?
NOTE: The opinions here represent the opinions of the individual posters, and not of Sajha.com. It is not possible for sajha.com to monitor all the postings, since sajha.com merely seeks to provide a cyber location for discussing ideas and concerns related to Nepal and the Nepalis. Please send an email to admin@sajha.com using a valid email address if you want any posting to be considered for deletion. Your request will be handled on a one to one basis. Sajha.com is a service please don't abuse it. - Thanks.

Sajha.com Privacy Policy

Like us in Facebook!

↑ Back to Top
free counters