Exemplo n.º 1
0
        static void Main(string[] args)
        {
            // declare variables
            double       N1, N2, N3, Total1, Total2;
            const double C = 7.777; //declare a constant
            string       Msg1, Msg2, N1S, N2S, N3S;

            //inputs
            Console.WriteLine("This program will add up 3 numbers of your choice. Then it will multiply the sum of these numbers by a constant value of 7.777 and display the value. Let's get started!");

            Console.WriteLine("\nEnter your first number between 1 - 1000 (decimal values are ok too)");
            N1S = Console.ReadLine();
            Console.WriteLine("Enter your second number between 1 - 1000 (decimal values are ok too)");
            N2S = Console.ReadLine();
            Console.WriteLine("Enter your third number between 1 - 1000 (decimal values are ok too)");
            N3S = Console.ReadLine();

            //process
            //convert string to double
            N1 = Convert.ToDouble(N1S);
            N2 = Convert.ToDouble(N2S);
            N3 = Convert.ToDouble(N3S);

            //do calculations
            Total1 = N1 + N2 + N3;
            Total2 = Total1 * C;
            Msg1   = "The total of your three numbers is " + Total1.ToString("N3");
            Msg2   = "The total multiplied by constant 7.777 is " + Total2.ToString("N3");

            //output

            Console.WriteLine(Msg1);
            Console.WriteLine(Msg2);
            Console.ReadKey();//Stopping point so the application doesn't close
        }
Exemplo n.º 2
0
        public void InitializeGetCountData()
        {
            GetCountData();

            //주차가능한 자리 수
            label1.Text = Count1.ToString(); label2.Text = Count2.ToString();
            label3.Text = Count3.ToString(); label4.Text = Count4.ToString();
            label5.Text = Count5.ToString();

            label16.Text = Count11.ToString();
            label17.Text = Count12.ToString(); label18.Text = Count13.ToString();
            label19.Text = Count14.ToString(); label20.Text = Count15.ToString();


            //주차되어진 자리 수
            label6.Text  = Count6.ToString(); label7.Text = Count7.ToString();
            label8.Text  = Count8.ToString(); label9.Text = Count9.ToString();
            label10.Text = Count10.ToString();

            label21.Text = Count16.ToString();
            label22.Text = Count17.ToString(); label23.Text = Count18.ToString();
            label24.Text = Count19.ToString(); label25.Text = Count20.ToString();

            //총 주차면 수
            label11.Text = Total1.ToString(); label12.Text = Total2.ToString();
            label13.Text = Total3.ToString(); label14.Text = Total4.ToString();
            label15.Text = Total5.ToString();

            label26.Text = Total6.ToString();
            label27.Text = Total7.ToString(); label28.Text = Total8.ToString();
            label29.Text = Total9.ToString(); label30.Text = Total10.ToString();


            //지우지 말 것
            Count1  = 0; Count2 = 0; Count3 = 0; Count4 = 0; Count5 = 0;
            Count6  = 0; Count7 = 0; Count8 = 0; Count9 = 0; Count10 = 0;
            Count11 = 0; Count12 = 0; Count13 = 0; Count14 = 0; Count15 = 0;
            Count16 = 0; Count17 = 0; Count18 = 0; Count19 = 0; Count20 = 0;

            Total1 = 0; Total2 = 0; Total3 = 0; Total4 = 0; Total5 = 0;
            Total6 = 0; Total7 = 0; Total8 = 0; Total9 = 0; Total10 = 0;
        }