// Main Method static void Main(string[] args) { // Implement GiantPlanet by Creating a giantPlanet object GiantPlanet giantPlanet = new GiantPlanet("Jupiter", 142800, 1.898e+27, "Gas"); Console.WriteLine(giantPlanet.ToString()); int moonCount = 69, ringCount = 4; giantPlanet.MoonCount = moonCount; giantPlanet.RingCount = ringCount; // set moon and ring count Console.WriteLine("{0}", giantPlanet.HasMoons() ? "This planet have moons :" + moonCount : "This planet dont have moons"); Console.WriteLine("{0}", giantPlanet.HasRings() ? "This planet have rings :" + ringCount : "This planet dont have rings"); // Implement GiantPlanet by Creating a giantPlanet object TerrestrialPlanet terrestrialPlanet = new TerrestrialPlanet("Mars", 6785, 6.4e+23, true); Console.WriteLine(terrestrialPlanet.ToString()); moonCount = 0; terrestrialPlanet.MoonCount = moonCount; Console.WriteLine("{0}", terrestrialPlanet.Habitable() ? "This planet have Oxygen, is habitable" : "This planet is not habitable"); Console.WriteLine("{0}", terrestrialPlanet.HasMoons() ? "This planet have moons" : "This planet dont have moons"); //Wait for any Key to close console WaitForAnyKey(); }
static void Main(string[] args) { GiantPlanet giantPlanet = new GiantPlanet("JUPITER", 139822, 317.8, "GAS"); GiantPlanet giantPlanet1 = new GiantPlanet("SATURN", 116464, 5.683, "GAS"); GiantPlanet giantPlanet2 = new GiantPlanet("NEPTUNE", 49244, 1.024, "GAS"); TerrestrialPlanet terrestrialPlanet = new TerrestrialPlanet("EARTH", 12742, 5.9722, true); Console.WriteLine("******************************************************"); Console.WriteLine("* GIANT PLANETS ARE AS FOLLOWS: *"); Console.WriteLine("******************************************************"); WAITFORANYKEY(); giantPlanet.ToString(); WAITFORANYKEY(); giantPlanet1.ToString(); WAITFORANYKEY(); giantPlanet2.ToString(); WAITFORANYKEY(); Console.WriteLine("\n"); Console.WriteLine("******************************************************"); Console.WriteLine("* TERRESTRIAL PLANET IS AS FOLLOWS: *"); Console.WriteLine("******************************************************"); Program.WAITFORANYKEY(); terrestrialPlanet.ToString(); Program.WAITFORANYKEY(); }
static void Main(string[] args) { GiantPlanet giantPlanet = new GiantPlanet("Jupiter", 69911, 317.8, "Gas"); Console.WriteLine(giantPlanet.ToString()); TerrestrialPlanet terrestrialPlanet = new TerrestrialPlanet("Earth", 40075.017, 5.97237, true); Console.WriteLine(terrestrialPlanet.ToString()); WaitForAnyKey(); }
static void Main(string[] args) { GiantPlanet myGiantPlanet = new GiantPlanet("Jupiter", 139822, 317.8, "Gas"); Console.WriteLine(myGiantPlanet.ToString()); // displays details of myGiantPlanet TerrestrialPlanet myTerrestrialPlanet = new TerrestrialPlanet("Earth", 12104, 5.972, true); Console.WriteLine(myTerrestrialPlanet.ToString()); // displays details of myTerrestrialPlanet WaitForAnyKey(); }