generated from admin/template
lab-01 done.
This commit is contained in:
@@ -0,0 +1,90 @@
|
||||
using System;
|
||||
using HelpMethods;
|
||||
|
||||
namespace Test
|
||||
{
|
||||
internal class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
string
|
||||
pokemonName = "Чармандер"
|
||||
, elementType = "Огонь";
|
||||
|
||||
byte level = 1;
|
||||
short hp = 95;
|
||||
|
||||
GetInfo(pokemonName, elementType, level, hp);
|
||||
CreatePassport();
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Метод для задания №1.
|
||||
/// </summary>
|
||||
/// <param name="name"></param>
|
||||
/// <param name="elType"></param>
|
||||
/// <param name="lvl"></param>
|
||||
/// <param name="hp"></param>
|
||||
static void GetInfo(string name, string elType, byte lvl, short hp)
|
||||
{
|
||||
const sbyte margine = -10;
|
||||
|
||||
string message =
|
||||
$@"
|
||||
====== INFO ======
|
||||
{"Pokemon:",margine}{name}
|
||||
{"Element:",margine}{elType}
|
||||
{"Level:",margine}{lvl} | HP: {hp}
|
||||
====================
|
||||
";
|
||||
|
||||
Console.WriteLine(message);
|
||||
SystemHelp.Waiting();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Методы для задания №2.
|
||||
/// </summary>
|
||||
static void CreatePassport()
|
||||
{
|
||||
SetValues();
|
||||
|
||||
static void SetValues()
|
||||
{
|
||||
byte maxStringLength = 20;
|
||||
|
||||
Console.Write("Fill out the forms.\t[20 chars]\n\nTrainer name: ");
|
||||
string trainerName = StringHelp.CutString(Console.ReadLine(), maxStringLength);
|
||||
|
||||
Console.Write("Pokemon name: ");
|
||||
string pokemonName = StringHelp.CutString(Console.ReadLine(), maxStringLength);
|
||||
|
||||
Console.Write("Element type: ");
|
||||
string elementType = StringHelp.CutString(Console.ReadLine(), maxStringLength);
|
||||
|
||||
Console.Write("Region name: ");
|
||||
string regionName = StringHelp.CutString(Console.ReadLine(), maxStringLength);
|
||||
|
||||
PrintPassport(trainerName, pokemonName, elementType, regionName);
|
||||
}
|
||||
static void PrintPassport(string trainer, string pokemon, string element, string region)
|
||||
{
|
||||
const sbyte
|
||||
margine1 = -9
|
||||
, margine2 = -11;
|
||||
|
||||
string message =
|
||||
$@"
|
||||
*************************************************************
|
||||
POKEMON'S PASSPORT
|
||||
{"Trainer:",margine1}{trainer}{" (Region:",margine2}{region})
|
||||
{"Pokemon:",margine1}{pokemon}{" (Element:",margine2}{element})
|
||||
*************************************************************
|
||||
";
|
||||
|
||||
Console.WriteLine(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user