define a class called dc with two data members: cname and duration. Include relevant constructors & operator methods to perform these operations:
dc c1= new dc("BSC",2);
dc c2= new dc("BMS",2);
if (c1>c2)
System.Console.WriteLine("c1>c2");
else if(c1==c2)
System.Console.WriteLine("c1=c2");
else
System.Console.WriteLine("c2>c1");
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
namespace Occurrences_of_the_second_string_in_the_fisrt
{
class dc {
public string cname;
public int duration;
public dc() { }
public dc(string cname, int duration)
{
// TODO: Complete member initialization
this.cname = cname;
this.duration = duration;
}
}
class Program
{
static void Main(string[] args)
{
dc c1 = new dc("BSC", 2);
dc c2 = new dc("BMS", 2);
if (c1.duration>c2.duration)
{
System.Console.WriteLine("c1>c2");
}else if(c1==c2) {
System.Console.WriteLine("c1=c2");
}else{
System.Console.WriteLine("c2>c1");
}
}
}
}
Need a fast expert's response?
Submit order
and get a quick answer at the best price
for any assignment or question with DETAILED EXPLANATIONS!
Learn more about our help with Assignments:
C#