+ Нов въпрос
CvetomirShterev 4 Точки

## 7.MilitaryElite - Interfaces and Abstraction - Exercise

https://github.com/CecoSht329/ExerciseOOP/tree/main/MilitaryElite Колеги това е моето решение на задчата .но дава само 40/100 . Някой може ли да ми каже къде бъркам?

Тагове:
0
Axiomatik 540 Точки

This exercise is of vital importance, don't focus on new material until you get 100% !!!

Missing elements :

Contracts

ICommando => void AddMission(IMission mission) ;

Models

Commando =>

-Inherits SpecialisedSoldier, ICommando

-private ICollection<IMission> missions; (better abstraction)

-Different constructor :

public Commando(int id, string firstName, string lastName, decimal salary, string corps)

: base(id, firstName, lastName, salary, corps)

{

this.missions = new List<IMission>();

}

-public string Corps => validated in SpecialisedSoldier, not Commando

Engineer =>

-Inherits SpecialisedSoldier, IEngineer

-Different constructor :

public Engineer(int id, string firstName, string lastName, decimal salary, string corps)

: base(id, firstName, lastName, salary, corps)

{

this.RepairList = new List<IRepair>();

}

-public List<IRepair> RepairList { get; private set; }

LieutenantGeneral =>

-public List<IPrivate> PrivateList { get; private set; }

Mission =>

- public void CompleteMission()

{

if (this.State == "inProgress")

{

this.State = "Finished";

}

}

Private =>

- public decimal Salary

{

get

{

return this.salary;

}

protected set

{

if (value < 0.0M)

{

throw new ArgumentException();

}

this.salary = value;

}

}

Repair =>

- public int Hours

{

get

{

return this.hours;

}

private set

{

if (value < 0)

{

throw new ArgumentException();

}

this.hours = value;

}

}

Soldier =>

- public int Id

{

get

{

return this.id;

}

protected set

{

if (value < 1)

{

throw new ArgumentException();

}

this.id = value;

}

}

SpecialisedSoldier : Private, ISpecialisedSoldier => Completely Missing, Needs to be implemented !!!

Spy =>

- public int CodeNumber

{

get

{

return this.codeNumber;

}

private set

{

if (value < 1)

{

throw new ArgumentException();

}

this.codeNumber = value;

}

}

StartUp =>

Seems to be OK, but is missing some try-catch blocks (“Commando”, “Engineer”, …) since some validations inside of the different classes throw exceptions.

0
CvetomirShterev 4 Точки

I fixed everything that you said was wrong , and still 40/100 in other words no improvements. But thanks for the help any way.

0
donamtf 5 Точки

nk you so much for this. I was into this issue and tired to   tinker around to check if its possible but couldnt get it done. Now that i have seen the way you did it, thanks guys
with
regards

_______________________

https://vidmate.onl/

-2