Exemplo n.º 1
0
        public static void Mercury() //these are the functions for the Mercury planet 
        {
            Console.WriteLine("Enter your weight");
            string user = Console.ReadLine();
            double value; 
            double total; 
            if (double.TryParse(user, out value) && value > 0) 

            {
                total = value * 0.37;
                Console.WriteLine("\n Your Weight is:" + total.ToString("0.0"));
                Console.WriteLine("Would you like to cotinue....y/n");
                string choice = Console.ReadLine();
                if (choice == "y" || choice == "Y") 
                {

                    prompt.text();
                    RunProgram.run();
                }
                else if (choice == "n" || choice == "N") 
                {
                    Console.WriteLine("thank you GoodBye");
                    System.Threading.Thread.Sleep(0);
                    Environment.Exit(0);
                }
                else 
                {
                    Console.WriteLine("Sorry that result is not valid");
                    Console.Clear();
                    prompt.text();
                    RunProgram.run();
                }
            }
            else 
            {
                Console.WriteLine("This is not correct please try again");
                Planets.Mercury();
            }
        }
Exemplo n.º 2
0
        public static void run() 
        {
            int select;
            Console.WriteLine("Select a planet using 1-9");
            string user = Console.ReadLine();
            int.TryParse(user, out select); 
            switch (select)   
            {
                case 1:
                    Planets.Mercury();
                    break;
                case 2:
                    Planets.Jupiter();
                    break;
                case 3:
                    Planets.Neptune();
                    break;
                case 4:
                    Planets.Venus();
                    break;
                case 5:
                    Planets.Saturn();
                    break;
                case 6:
                    Planets.Pluto();
                    break;
                case 7:
                    Planets.Mars();
                    break;
                case 8:
                    Planets.Uranus();
                    break;

                case 9:
                    Console.WriteLine("Would you like to exit....y/n"); 
                    string choice = Console.ReadLine();
                    if (choice == "y" || choice == "Y") 
                    {

                        prompt.text();
                        RunProgram.run();
                    }
                    else if (choice == "n" || choice == "N")
                    {
                        Console.WriteLine("thank you GoodBye");
                        System.Threading.Thread.Sleep(2000);
                        Environment.Exit(0);
                    }
                    else 
                    {
                        Console.WriteLine("Sorry that result is not valid");
                        Console.Clear(); 
                        prompt.text();  
                        RunProgram.run(); 
                    }
                    break; 
                default: Console.WriteLine("This is out of range of the options please try again"); 
                    Console.Clear();
                    prompt.text();
                   RunProgram.run();
                    break;

            }
        }