Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions interfaceProject/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
using System;
using System.Collections.Generic;

namespace interfaceProject
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can see that you have the right idea, but none of you classes implement an interface.

{
public interface IYearly
{
int findYearlySalary();
}
class Program
{
static void Main(string[] args)
{
Developer d1 = new Developer(40000);
Developer d2 = new Developer(90000);

Contractor c1 = new Contractor(400);
Contractor c2 = new Contractor(700);

Engineer e1 = new Engineer(4000);
Engineer e2 = new Engineer(8000);

List<IYearly> yearlySalaries = new List<IYearly>();
}
}

class Developer
{
public int yearlySalary;

public Developer(int yearly)
{
this.yearlySalary = yearly;
}

public int findYearlySalary()
{
return yearlySalary;
}

}

class Contractor
{
public int weeklySalary;

public Contractor(int weekly)
{
this.weeklySalary = weekly;
}

public int findYearlySalary()
{
return weeklySalary*52;
}
}

class Engineer
{
public int monthlySalary;

public Engineer(int monthly)
{
this.monthlySalary = monthly;
}

public int findYearlySalary()
{
return monthlySalary*12;
}
}
}
8 changes: 8 additions & 0 deletions interfaceProject/interfaceProject.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>

</Project>