Showing posts with label C# project. Show all posts
Showing posts with label C# project. Show all posts

Tuesday, 23 April 2013

22nd April 2013 this qt asked by inst(Discount)


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

namespace ConsoleApplication24
{
    class bill
    {
        string itnm;
        int rs, disc, final, num;
        public void get()
        {
            Console.WriteLine("enter the item name:");
            itnm = Convert.ToString(Console.ReadLine().ToLower());
            Console.WriteLine("Enter the price of item:");
            rs = Convert.ToInt32(Console.ReadLine());
        }
        public void select()
        {
            Console.WriteLine("choose 1 for pay by CC or 2 by DC");
            num = Convert.ToInt32(Console.ReadLine());
            switch (num)
            {
                case 1:
                    Console.WriteLine("pay by Credit Card:");
                    break;
                case 2:
                    Console.WriteLine("pay by Debit Card:");
                    break;
                default:
                    Console.WriteLine("Invaid input");
                    break;
            }
        }
        public void discount()
        {
            if (rs > 20000)
            {
                disc = rs * 20 / 100;
                final = rs - disc;
                Console.WriteLine("Price after 20% discount to be paid:" + final);
            }
            else if (rs > 12000 && rs < 20000)
            {
                disc = rs * 10 / 100;
                final = rs - disc;
                Console.WriteLine("Price after 10% discount to be paid:" + final);
            }
            else if(rs < 12000)
            {
                disc=rs*5/100;
                final=rs-disc;
                Console.WriteLine("Price after 5% discount to be paid"+final);
            }
        }
    }


    class Program
    {
        static void Main(string[] args)
        {
            bill b=new bill();
            b.get();
            b.select();
            b.discount();
            Console.ReadLine();
        }
    }
}

Monday, 22 April 2013

whichOneIsGreatest


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

namespace whichOneIsGreatest
{
    class Program
    {
        static void Main(string[] args)
        {
            int Num1, Num2, Num3;
            Console.WriteLine("Enter the Number");
            Console.Write("Num1:");
            Num1 = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("Enter the Number");
            Console.Write("Num2:");
            Num2 = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("Enter the Number");
            Console.Write("Num3:");
            Num3 = Convert.ToInt32(Console.ReadLine());
            if (Num1 > Num2 && Num1 > Num3)
            {
                Console.WriteLine("The Greatest Number is:" + Num1);
            }
            else if (Num2 > Num1 && Num2 > Num3)
            {
                Console.WriteLine("The Greatest Number is:" + Num2);
            }
            else if (Num3 > Num1 && Num3 > Num2)
            {
                Console.WriteLine("The Greatest Number is:" + Num3);
            }
            else if (Num1 == Num2 && Num1 == Num3)
            {
                Console.WriteLine("All number are same");
                Console.ReadLine();
            }
        }
    }
}

pdoffsttenevennum


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

namespace pdoffsttenevennum
{
    class Program
    {
        static void Main(string[] args)
        {
            int Num, pd;
            Num=2;
            pd = 1;
            int i = 0;
                for(i=0;i<=9;i++)
            {
                pd = Num * pd;
                Num = Num + 2;
                }
            {
                Console.Write("Display the Product of First Ten Even Numbers:"+pd);
            }
                Console.ReadLine();
        }
    }
}

Ex10menu


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

namespace Ex10menu
{
    class Program
    {
        static void Main(string[] args)
        {
            int Option;
            Option = 4;
            Console.WriteLine("Enter a Option Number:");
            Console.Write("\nOption: ");
            Option = Convert.ToInt32(Console.ReadLine());
            switch (Option)
            {
                case 1:
                    Console.Write("\nThis application will allow you to create a pyramid structure.");
                    break;
                case 2:
                    Console.Write("\nThis application will allow you to add two primary colors and displays third color.");
                    break;
                case 3:
                    Console.Write("\nThis application will allow you to create meanningful words from jumbled letters.");
                    break;
                case 4:
                    Console.Write("\nThis application will allow you to create multilpe words from a single word.");
                    Console.Write("\nEach will increase your score by 1.");
                    break;
                default:
                    Console.Write("\nInvalid Option entered.");
                    break;
            }
            Console.ReadLine();
        }
    }
}

employee


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

namespace ConsoleApplication1
{
    class employee
    {
        int ID, SAL, CAL;
        string NAME;
        public void accept()
        {
            Console.WriteLine("Enter ID");
            ID = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("Enter NAME");
            NAME = Console.ReadLine();
            Console.WriteLine("Enter SAL");
            SAL = Convert.ToInt32(Console.ReadLine());
        }
        public void calc()
        {
            CAL = SAL * 12;
            Console.WriteLine("display the cal:" + CAL);
        }
    }
      class program
      {
    static void Main(string[] args)
        {
            employee e = new employee();
            e.accept();
            e.calc();
        }
    }
}

divsecnumisZero


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

namespace divsecnumisZero
{
    class Program
    {
        static void Main(string[] args)
        {
            int Num1, Num2;
            Console.ForegroundColor = ConsoleColor.Cyan;
            Console.WriteLine("Enter the first number");
            Console.Write("Num1: ");
            Num1 = Convert.ToInt32(Console.ReadLine());
            Console.ForegroundColor = ConsoleColor.Magenta;
            Console.WriteLine("\nEnter the Second number");
            Console.Write("Num2: ");
            Num2 = Convert.ToInt32(Console.ReadLine());
            if (Num2 == 0)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.Write("\nSorry Second number is Zero");
                Console.Write("\nThank You");
            }
            else if (Num1 % Num2 == 0)
            {
                Console.ForegroundColor = ConsoleColor.Green;
                Console.Write("\nFirst number is divisible by Second number");
                Console.Write("\nThank You");
            }
            else
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.Write("First number is Not divisible by Second number");
                Console.Write("\nThank You");
            }
            Console.ReadLine();
        }
    }
}

testdivisibleby5


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

namespace testdivisibleby5
{
    class Program
    {
        static void Main(string[] args)
        {
            int Num, nRim;
            Console.WriteLine("Enter the Number");
            Console.Write("Num:");
            Num = Convert.ToInt32(Console.ReadLine());
            nRim = Num%5;
            if (nRim==0)
            {
                Console.Write("Number is divisible by 5");
                Console.ReadLine();
            }
            else
            {
                Console.Write("Number is not divisible by 5");
                Console.ReadLine();
            }
        }
    }
}

divfstysecnchksecforzeroOretfst


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

namespace divfstysecnchksecforzeroOretfst
{
    class Program
    {
        static void Main(string[] args)
        {
            int Num1, Num2, Qt;
            Console.WriteLine("Enter the First Number:");
            Console.Write("Num1: ");
            Num1 = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("\nEnter the Second Number:");
            Console.Write("Num2: ");
            Num2 = Convert.ToInt32(Console.ReadLine());
            if (Num2 == 0)
            {
                Console.Write("\nSecond Number is Zero");
            }
            else if (Num1 < Num2)
            {
                Console.Write("\nSecond Number is Larger than First Number");
            }
            else
            {
                Qt = Num1 / Num2;
                Console.Write("\nDisplay the Qutient is: " + Qt);
            }
                 Console.ReadLine();
        }
    }
}

Geometrical_Shapes


using System;
class Geometrical_Shapes
{
double Area;
string Shape;
string Color;

public void GetInput ()
{
Console.Write("Enter the name of the shape: ");
Shape = Console.ReadLine();
Console.Write("Enter the Color: ");
Color = Console.ReadLine();
Console.Write("Enter the Area: ");
Area = Convert.ToDouble(Console.ReadLine());
}

public void Display()
{
Console.WriteLine();
Console.WriteLine("THIS IS WHAT YOU ENTERED: \n");
Console.Write("Name of the Shape: ");
Console.WriteLine(Shape);
Console.Write("Color: ");
Console.WriteLine(Color);
Console.Write("Area: ");
Console.WriteLine(Area);
}
}
class Classy
{
static void Main(string[] args);
Geometrical_Shapes Small_rectangle = new Geometrical_Shapes ();
Small_rectangle.Create();
small_rectangle.Display();
Console.ReadLine();
}

book


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

namespace book
{
    class Book
    {
        string BookCat;
        string FirstName;
        string LastName;
        int IsbnNo;
        int NoOfCopies;
    }
        public void Display();
        {
        Console.WriteLine("\nThe followingare the details of the book");
        Console.Write("Category of the Book: ");
        Console.WriteLine("BookCat");
        Console.Write("Name of the Author: ");
        Console.WriteLine("FirstName");
        Console.Writeline("{0},LastName");
        Console.write("ISBN Number");
        Console.WriteLine("IsbnNo");
        Console.Write("No of Copies: ");
        Console.Write("NoOfCopies");
        }
    public void Get()
        {
            Console.WriteLine("Please enter the details of the Book");
            Console.writeLine("Enter the Category of the Book(Fiction/Nonficition): ");
            BookCat=Console.ReadLine();
            Console.WriteLine("First Name of The Author: ");
            FirstName=Console.ReadLine();
            Console.WriteLine("Last Name of Author: ");
            LastName=Console.ReadLine();
            Console.WriteLine("ISBN Number");
            IsbnNo=Convert.ToInt32(COnsole.ReadLine());
            Console.WriteLine("Number of Copies; ");
            NoOfCopies=Convert.ToInt32(Console.ReadLine());
        }
    }
    class MyClass
    {
        static void Main(string[] args);
        {
        Book My_Fav= new Book();
        My_Fav.Get();
        My_Fav.Display();
        Console.ReadLine();
        }
    }

AcceptFiveNumberChkEvenOdd


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

namespace AcceptFiveNumberChkEvenOdd
{
    class Program
    {
        static void Main(string[] args)
        {
            int num1, num2, num3, num4, num5;
            Console.ForegroundColor = ConsoleColor.Yellow;
            Console.WriteLine("Accept five Numbers and Check them for Even or Odd:");
            Console.WriteLine("\nEnter the Number");
            Console.Write("num1: ");
            num1 = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("\nEnter the Number");
            Console.Write("num2: ");
            num2 = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("\nEnter the Number");
            Console.Write("num3: ");
            num3 = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("\nEnter the Number");
            Console.Write("num4: ");
            num4 = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("\nEnter the Number");
            Console.Write("num5: ");
            num5 = Convert.ToInt32(Console.ReadLine());
            if (num1 % 2 == 0)
            {
                Console.ForegroundColor = ConsoleColor.Cyan;
                Console.Write("\nnum1 is Even");
            }
            else
            {
                Console.ForegroundColor = ConsoleColor.Green;
                Console.Write("\nnum1 is Odd");
            }
            if (num2 % 2 == 0)
            {
                Console.ForegroundColor = ConsoleColor.Cyan;
                Console.Write("\nnum2 is Even");
            }
            else
            {
                Console.ForegroundColor = ConsoleColor.Green;
                Console.Write("\nnum2 is Odd");
            }
            if (num3 % 2 == 0)
            {
                Console.ForegroundColor = ConsoleColor.Cyan;
                Console.Write("\nnum3 is Even");
            }
            else
            {
                Console.ForegroundColor = ConsoleColor.Green;
                Console.Write("\nnum3 is Odd");
            }
            if (num4 % 2 == 0)
            {
                Console.ForegroundColor = ConsoleColor.Cyan;
                Console.Write("\nnum4 is Even");
            }
            else
            {
                Console.ForegroundColor = ConsoleColor.Green;
                Console.Write("\nnum4 is Odd");
            }
            if (num5 % 2 == 0)
            {
                Console.ForegroundColor = ConsoleColor.Cyan;
                Console.Write("\nnum5 is Even");
            }
            else
            {
                Console.ForegroundColor = ConsoleColor.Green;
                Console.Write("\nnum5 is Odd");
            }
            Console.ForegroundColor = ConsoleColor.DarkYellow;
            Console.Write("\n\nTHANK YOU");
            Console.ReadLine();
        }
    }
}

InputFiveNumberSumAvg


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

namespace InputFiveNumberSumAvg
{
    class Program
    {
        static void Main(string[] args)
        {
            int nNum1, nNum2, nNum3, nNum4, nNum5;
            int nSum, nAvg;
            Console.WriteLine("Enter the Number");
            Console.Write("nNum1:");
            nNum1 = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("Enter the Number");
            Console.Write("nNum2:");
            nNum2 = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("Enter the Number");
            Console.Write("nNum3:");
            nNum3 = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("Enter the Number");
            Console.Write("nNum4:");
            nNum4 = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("Enter the Number");
            Console.Write("nNum5:");
            nNum5 = Convert.ToInt32(Console.ReadLine());
            nSum = nNum1 + nNum2+ nNum3 + nNum4 + nNum5 ;
            Console.ForegroundColor=ConsoleColor.Yellow;
            Console.Write("Display the sum is: "+nSum);
            nAvg = nSum / 5;
            Console.Write("\nDisplay the avg is: "+nAvg);
            Console.ReadLine();
        }
    }
}