Example #1
0
        static void Main(string[] args)
        {
            Logic.Mathematics maths    = new Logic.Mathematics();
            double            subtract = maths.Substraction(5.2, 7.4);
            double            add      = maths.Addition(20.2, 3.8);
            float             division = maths.Division(50.6f, 9.3f);
            decimal           multiply = maths.Multiply(7.5m, 9.25m);

            Console.WriteLine(subtract);
            Console.WriteLine(add);
            Console.WriteLine(division);
            Console.WriteLine(multiply);

            Console.WriteLine("-------");
            Console.WriteLine("-------");

            AgeCalculator checkAge = new AgeCalculator();

            Console.Write("Please enter age: ");
            string userInput = Console.ReadLine();

            checkAge.Calculator(Convert.ToInt32(userInput));
            Console.WriteLine($"as this person is {userInput} years of age");

            Console.WriteLine("-------");
            Console.WriteLine("-------");

            OddorEven oddOrEven = new OddorEven();

            oddOrEven.isOddorEven(2);

            Console.WriteLine("-------");
            Console.WriteLine("-------");

            Pie slices = new Pie();

            slices.Slices(12, 6, 3);

            Console.WriteLine("-------");
            Console.WriteLine("-------");

            /*
             * create multiple variables about yourself declared as private
             * then create a public method to access the variables in a structured way
             * Console.WriteLine about yourself
             * Display that method inside of Program.cs
             */

            Encapsulation encapsulation = new Encapsulation();

            encapsulation.Information();

            /*
             * float = 10.5f
             * double = 10.5
             * decimal = 10.5m
             */
        }
Example #2
0
        static void Main(string[] args)
        {
            AgeCalculator myAge = new AgeCalculator();

            Console.Write("Please enter your age: ");
            string userInput = Console.ReadLine();
            //OR myAge.Calculator(Convert.ToInt32(userInput)); To convertthe userInput(string) to function
            //intake(int).

            string hello = "Hello!";

            Console.WriteLine($"Your age check says you are {userInput}. {hello}");
            myAge.Calculator(Int32.Parse(userInput));
            Encapsulation example = new Encapsulation();

            example.name   = "char";
            example.salary = 200000;
            example.information();
            Personal info = new Personal();

            info.deetz();
            PhoneNumber digits = new PhoneNumber();

            digits.getNumber();


            Mathematics maths            = new Mathematics();
            double      addMePlease      = maths.Addition(10, 2.5);
            double      subtractMePlease = maths.Subtraction(10, 23.5);
            double      multiMePlease    = maths.Multiplication(10, 21);
            double      divideMePlease   = maths.Division(10, 29);

            Console.WriteLine(addMePlease);
            Console.WriteLine(subtractMePlease);
            Console.WriteLine(multiMePlease);
            Console.WriteLine(divideMePlease);
            Encapsulation person = new Encapsulation();
            string        person = "char";
            double        person = 200000;

            person.information();



            ////-------------------------------------

            //Below is an example of how you can substitute the doubles for 'decimal and float'.
            //We would replace 'double' with 'decimal and float' in the 'multiMePlease' and 'divideMePlease'
            //methods in the Mathematics Class.

            // double addMePlease = maths.Addition(10, 2.5);
            // double subtractMePlease = maths.Subtraction(10,23.5);
            // decimal multiMePlease = maths.Multiplication(10m,27m);
            // float divideMePlease = maths.Division(10f,29f);



            //encapsulation ---
            //private - limiting access to the same class
            //public - free for all - any object can access the data
            //protected - limits access to the same class OR descendants
            //internal - c# only for OOP - limits access to a namespace (asssembly)
        }