static void Main() { try { string author = Console.ReadLine(); string title = Console.ReadLine(); decimal price = decimal.Parse(Console.ReadLine()); Book book = new Book(author, title, price); GoldenEditionBook goldenEditionBook = new GoldenEditionBook(author, title, price); Console.WriteLine(book + Environment.NewLine); Console.WriteLine(goldenEditionBook); } catch (ArgumentException ae) { Console.WriteLine(ae.Message); } }
static void Main(string[] args) { try { string author = Console.ReadLine(); string title = Console.ReadLine(); double price = double.Parse(Console.ReadLine()); Book book = new Book(author, title, price); GoldenEditionBook goldenEditionBook = new GoldenEditionBook(author, title, price); Console.WriteLine(book); Console.WriteLine(goldenEditionBook); } catch (ArgumentException ae) { Console.WriteLine(ae.Message); } }
public static void Main() { try { var author = Console.ReadLine(); var title = Console.ReadLine(); var price = decimal.Parse(Console.ReadLine()); var book = new Book(author, title, price); var goldenEditionBook = new GoldenEditionBook(author, title, price); Console.WriteLine(book); Console.WriteLine(goldenEditionBook); } catch (ArgumentException ae) { Console.WriteLine(ae.Message); } }
static void Main() { string author = Console.ReadLine(); string title = Console.ReadLine(); decimal price = decimal.Parse(Console.ReadLine()); try { Book book = new Book(title, author, price); GoldenEditionBook goldenEdition = new GoldenEditionBook(title, author, price); Console.WriteLine(book); Console.WriteLine(); Console.WriteLine(goldenEdition); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
static void Main() { try { Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; string author = Console.ReadLine(); string title = Console.ReadLine(); decimal price = decimal.Parse(Console.ReadLine()); Book book = new Book(author, title, price); GoldenEditionBook goldenEditionBook = new GoldenEditionBook(author, title, price); Console.WriteLine(book); Console.WriteLine(goldenEditionBook); } catch (ArgumentException ae) { Console.WriteLine(ae.Message); } }