Pages

Make a c# Class that have Two METHODS getData() And display()....using Classes And Methods

INPUT:


using System;
using System.Collections.Generic;
using System.Text;

namespace ConsoleApplication2
{
    class Program
    {
     
        static void Main(string[] args)
        {
           
            Computer c = new Computer();
            c.GetData();
            c.Display();
          
           
        }
        class Computer
        {
            string Colour;
            int Model;
            int ScreenSize;
            public void GetData()
            {

                Console.WriteLine("Plz Enter Colour");
                Colour = Console.ReadLine();
                Console.WriteLine("Plz Enter Model");
                Model = Convert.ToInt32(Console.ReadLine());
                Console.WriteLine("Plz Enter The Screen Size");
                ScreenSize = Convert.ToInt32(Console.ReadLine());

            }
           
            public void Display()
            {

              
                Console.WriteLine("Computer Colour in {0}",Colour);
                Console.WriteLine("Computer Model  in {0}", Model);
                Console.WriteLine("Computer Model  in {0}",ScreenSize);
              

            }
        }
    }
}

OUTPUT:


No comments:

Post a Comment