static void Main(string[] args) { Book book1 = new Book(); //最初のBookはvarでもいい book1.title = "C#入門"; book1.publishedDate = new DateTime(2000,11,11); book1.author = "七月太郎"; book1.price = 1000; int taxIncludedPrice = book1.getTaxIncludedPrice(); int tax = book1.getTax(); Console.WriteLine(tax + " " + taxIncludedPrice); Console.WriteLine(book1.title); Console.WriteLine(book1.author); Magazine mag1 = new Magazine(); mag1.title = "ベーシックマガジン"; mag1.price = 1000; mag1.month = 1; int taxInclujdedPrice = mag1.getTaxIncludedPrice(); string monthStr = mag1.getMonth(); Novel nov1 = new Novel(); nov1.title = "のー"; nov1.series = "赤"; Console.WriteLine(tax + " " + taxIncludedPrice); Console.WriteLine(mag1.title); Console.WriteLine(mag1.author); Console.WriteLine(tax + " " + taxIncludedPrice); Console.WriteLine(nov1.title); Console.WriteLine(nov1.author); }
static void Main(string[] args) { var book1 = new Book(); book1.title = "C#入門"; book1.publishedDate = new DateTime(2000, 12, 31); book1.author = "七月太郎"; book1.price = 1000; int taxIncludedPrice = book1.getTaxIncludedPrice(); int tax = book1.getTax(); Console.WriteLine(tax + " " + taxIncludedPrice); Console.WriteLine(book1.title); Console.WriteLine(book1.author); var p1 = new Person(); p1.lastName = "田中"; p1.firstName = "太郎"; p1.furiganaLastName = "たなか"; p1.furiganaFirstName = "たろう"; p1.birthday = new DateTime(2009, 1, 1); Console.Write(p1.lastName + " " + p1.firstName); Console.Write("(" + p1.furiganaLastName + " " + p1.furiganaFirstName + ")、"); Console.WriteLine(p1.birthday.Year + "/" + p1.birthday.Month + "/" + p1.birthday.Day + "生 " + p1.getAge() + "才"); var p2 = new Person(); p2.lastName = "鈴木"; p2.firstName = "花子"; p2.furiganaLastName = "すずき"; p2.furiganaFirstName = "はなこ"; p2.birthday = new DateTime(1998, 12, 31); Console.Write(p2.lastName + " " + p2.firstName); Console.Write("(" + p2.furiganaLastName + " " + p2.furiganaFirstName + ")、"); Console.WriteLine(p2.birthday.Year + "/" + p2.birthday.Month + "/" + p2.birthday.Day + "生 " + p2.getAge() + "才"); }