namespace GameLibrary
{
using Models;
using Services;
class MainClass
{
static void Main()
{
var game = new Game
{
Title = "Doom",
Rating = 16
};
GameDisplayer.Display(game);
}
}
}
namespace GameLibrary.Models
{
public class Game
{
public string Title { get; set; }
public int Rating { get; set; }
public bool RatedR => Rating >= 18;
}
}
namespace GameLibrary.Services
{
using static System.Console;
using Models;
public class GameDisplayer
{
public static void Display(Game game)
{
Write(GameFormatter.Format(game));
}
}
}
namespace GameLibrary.Services
{
using static System.Environment;
using Models;
public class GameFormatter
{
public static string Format(Game game)
{
var formattedGame = $"Title: {game.Title}{NewLine}";
formattedGame += $"Rated R: {game.RatedR}{NewLine}";
return formattedGame;
}
}
}