Начинающий! В программе мне нужно, чтобы он выводил результаты в нужном порядке, а выводится верх тормашками образно говоря...код не очень хорошо выглядит...
Стрелочкой указал, мне нужно,чтобы они выводились...
Код:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication6
{
abstract class Zoo
{
public Int16 Number;
public Int32 iN;
public string TypeOfZoo;
public byte Time, iAdults_iChildrens;
public int ipriceforadults, ipriceforchildrens;
public abstract void Animals();
public abstract void Entry_Price();
public abstract void Print();
}
class ExoticZoo : Zoo
{
public override void Animals()
{
Console.WriteLine("Type of animals: exotic");
Console.WriteLine("Exotic animals: Жирафы, Кенгуру, Тигры, Льыы, Леопарды, Носухи, Кинкажу, Генетты ");
}
public override void Entry_Price()
{
Console.WriteLine("Enter the max value of price for a adults: ");
ipriceforadults = Int32.Parse(Console.ReadLine());
if (ipriceforadults > 40)
throw new ArgumentOutOfRangeException("price for adults");
Console.WriteLine("Enter the max value of price for childrens: ");
ipriceforchildrens = Int32.Parse(Console.ReadLine());
if (ipriceforchildrens > 25)
throw new ArgumentOutOfRangeException("price for childrens");
}
public override void Print()
{
Console.WriteLine("Value of price for adults is: {0}", ipriceforadults);
Console.WriteLine("Value of price for childrens: {0}", ipriceforchildrens);
Console.WriteLine("With respect, Zoo administration");
}
}
class NorthZoo : Zoo
{
public override void Animals()
{
Console.WriteLine("Type animals: north animals");
Console.WriteLine("Type of north animals: Койот, Гризли, Калан, Белый медведь, Лоси, Олени, Кабарга");
}
public override void Entry_Price()
{
Console.WriteLine("Enter the max price for adults: ");
ipriceforadults = Int32.Parse(Console.ReadLine());
if (ipriceforadults > 30)
throw new ArgumentOutOfRangeException("price for adults");
Console.WriteLine("Enter the price for childrens: ");
ipriceforchildrens = Int32.Parse(Console.ReadLine());
if (ipriceforchildrens > 20)
throw new ArgumentOutOfRangeException("price for childrens");
}
public override void Print()
{
Console.WriteLine("The max value of price for adults: {0}", ipriceforadults);
Console.WriteLine("The max value of price for childrens: {0}", ipriceforchildrens);
Console.WriteLine("With respect, Zoo administration");
}
}
class Program
{
static void Main(string[] args)
{
ExoticZoo ExoticAnimals = new ExoticZoo();
NorthZoo NorthAnimals = new NorthZoo();
Zoo zoo;
Console.WriteLine("Which class of zoo do you want to visit: 1 - exotic; 2 - animals");
int i = Int32.Parse(Console.ReadLine());
if (i == 1)
{
zoo = ExoticAnimals;
}
else
{
zoo = NorthAnimals;
}
Console.WriteLine("Vvedite detskih posetiteley: ");
zoo.iN = Int16.Parse(Console.ReadLine());
Console.WriteLine("Vvedite kolichestvo vzroslih posetitelei: ");
zoo.iN = Int32.Parse(Console.ReadLine());
Console.WriteLine("Enter the time which do you want to be in: {0} hours ");
zoo.Time = Byte.Parse(Console.ReadLine());
Console.WriteLine("Enter the the value of childrens and adults: ");
zoo.iAdults_iChildrens = Byte.Parse(Console.ReadLine());
Console.WriteLine("Enter the value of age childrens: {0}", zoo.Number);
zoo.Animals();
zoo.Entry_Price();
zoo.Print();
}
}
}