Loading...

Във форума е въведено ограничение, което позволява на потребителите единствено да разглеждат публикуваните въпроси.

DenislavTanev avatar DenislavTanev 0 Точки

Problem04. Wild Farm от Polymorphism

Колеги някой може ли да ми каже, каква е грешката в кода ...  на дебуг работи перфектно .. а judge ми дава RunTime Error...вече 9-10 часа се занимавам с този проблем.

Благодаря предварително!

https://github.com/WolfieSquat/Polymorphism

Условие:

Problem 1.Wild Farm

Your task is to create a class hierarchy like the described below. The Animal, Bird, Mammal, Feline and Food classes should be abstract. Override the method ToString().

  • Food – int Quantity;
    • Vegetable;
    • Fruit;
    • Meat;
    • Seeds;

 

 

 

  • Animal – string Name, double Weight, int FoodEaten;
    • Bird – double WingSize;
      1. Owl;
      2. Hen;
    • Mammal – string LivingRegion;
      1. Mouse;
      2. Dog;
      3. Feline – string Breed;
        • Cat;
        • Tiger;

    All animals should also have the ability to ask for food by producing a sound.

    • Owl – "Hoot Hoot";
    • Hen – "Cluck";
    • Mouse – "Squeak";
    • Dog – "Woof!";
    • Cat – "Meow";
    • Tiger – "ROAR!!!";

    Now use the classes that you have created to instantiate some animals and feed them.
    Input should be read from the console. Every even line (starting from 0) will contain information about an animal in the following format:

    • Felines - "{Type} {Name} {Weight} {LivingRegion} {Breed}";
    • Birds - "{Type} {Name} {Weight} {WingSize}";
    • Mice and Dogs - "{Type} {Name} {Weight} {LivingRegion}";

    On the odd lines, you will receive information about a piece of food that you should give to that animal. The line will consist of a FoodType and quantity, separated by a whitespace.

    Animals will only eat a certain type of food, as follows:

    • Hens eat everything;
    • Mice eat vegetables and fruits;
    • Cats eat vegetables and meat;
    • Tigers, Dogs and Owls eat only meat;

    If you try to give an animal a different type of food, it will not eat it and you should print:

    • "{AnimalType} does not eat {FoodType}!"

    The weight of an animal will increase with every piece of food it eats, as follows:

    • Hen – 0.35;
    • Owl – 0.25;
    • Mouse – 0.10;
    • Cat – 0.30;
    • Dog – 0.40;
    • Tiger – 1.00;

    Override the ToString() method to print the information about an animal in the formats:

    • Birds "{AnimalType} [{AnimalName}, {WingSize}, {AnimalWeight}, {FoodEaten}]"
    • Felines – "{AnimalType} [{AnimalName}, {Breed}, {AnimalWeight}, {AnimalLivingRegion}, {FoodEaten}]"
    • Mice and Dogs – "{AnimalType} [{AnimalName}, {AnimalWeight}, {AnimalLivingRegion}, {FoodEaten}]"

    After you have read the information about the animal and the food, the animal will produce a sound (print it on the console). Next, you should try to feed it. After receiving the “End” command, print information about every animal in order of input.

    Input

    Output

    Cat Pesho 1.1 Home Persian

    Vegetable 4

    End

    Meow

    Cat [Pesho, Persian, 2.3, Home, 4]

    Tiger Typcho 167.7 Asia Bengal

    Vegetable 1

    Dog Doncho 500 Street

    Vegetable 150

    End

    ROAR!!!

    Tiger does not eat Vegetable!

    Woof!

    Dog does not eat Vegetable!

    Tiger [Typcho, Bengal, 167.7, Asia, 0]

    Dog [Doncho, 500, Street, 0]

    Mouse Jerry 0.5 Anywhere

    Fruit 1000

    Owl Toncho 2.5 30

    Meat 5

    End

    Squeak

    Hoot Hoot

    Mouse [Jerry, 100.5, Anywhere, 1000]

    Owl [Toncho, 30, 3.75, 5]

Тагове:
0
C# OOP Basics
prohause avatar prohause 356 Точки

Използваш ли скелета

0
DenislavTanev avatar DenislavTanev 0 Точки

Да, добавил съм много излишна функционалност.. И всичко работи перфектно на конзола и на дебъг..

А Judge-а ми дава този Error на 3 различни кода.
Could not execute because the specified command or file was not found.
Possible reasons for this include:
  * You misspelled a built-in dotnet command.
  * You intended to execute a .NET Core program, but dotnet-C:/Windows/TEMP/ExecutionStrategies/vsgd01k3.y1a/CompilationDir/Wild does not exist.
  * You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
0
prohause avatar prohause 356 Точки

Можеш ли да качиш решението точно във формата в която го качваш в Judge 

0
DenislavTanev avatar DenislavTanev 0 Точки

Смисъл? кода ли

0
prohause avatar prohause 356 Точки

Да. Ама ако може целия архив който качваш в Judge 

0
Можем ли да използваме бисквитки?
Ние използваме бисквитки и подобни технологии, за да предоставим нашите услуги. Можете да се съгласите с всички или част от тях.
Назад
Функционални
Използваме бисквитки и подобни технологии, за да предоставим нашите услуги. Използваме „сесийни“ бисквитки, за да Ви идентифицираме временно. Те се пазят само по време на активната употреба на услугите ни. След излизане от приложението, затваряне на браузъра или мобилното устройство, данните се трият. Използваме бисквитки, за да предоставим опцията „Запомни Ме“, която Ви позволява да използвате нашите услуги без да предоставяте потребителско име и парола. Допълнително е възможно да използваме бисквитки за да съхраняваме различни малки настройки, като избор на езика, позиции на менюта и персонализирано съдържание. Използваме бисквитки и за измерване на маркетинговите ни усилия.
Рекламни
Използваме бисквитки, за да измерваме маркетинг ефективността ни, броене на посещения, както и за проследяването дали дадено електронно писмо е било отворено.