Професионална програма
Loading...
+ Нов въпрос
Axiomatik avatar 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) ;

IEngineer => void AddRepair(IRepair repair);

ILieutenantGeneral => void AddPrivate(ISoldier @private);

 

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 avatar 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 avatar 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