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

Friday, 8 November 2013

Online Shopping Program using C# .NET using 5 Components | SOA Lab Manual



Consoleapplication:

using System;
using System.Collections.Generic;
using System.Text;
using customer;
using computer;
using computerdetails;
using invoice;
using orderclass;
using bill;
namespace ConsoleApplication
{
class Program
{
static void Main(string[] args)
{
string i;
int h;
Console.WriteLine("ONLINE SHOPPING");
Console.WriteLine("COMPUTER SALE");
Console.WriteLine("1.VIEW CATALOGUE");
Console.WriteLine("2.EXIT");
Console.WriteLine("ENTER YOUR CHOICE");
i = Console.ReadLine();
h = int.Parse(i);
switch (h)
{
case 1:
{
com o2 = new com();
o2.display1();
co_det O3 = new co_det();
O3.detail3();
cus o1 = new cus();
o1.display();
Corder o4 = new Corder();
o4.display4();
inv o5=new inv();
o5.display5();
bll x1 = new bll();
x1.billdisp();
Console.ReadLine();
}
break;
case 2:
break;
}}}}

Components:
computer:

using System;
using System.Collections.Generic;
using System.Text;
namespace computer
{
public class com
{
int a;
public void display1()
{
Console.WriteLine("COMPUTERS");
Console.WriteLine("1.dell");
Console.WriteLine("2.hcl");
Console.WriteLine("3.lava");
Console.WriteLine("4.sony");
Console.WriteLine("5.samsung");
}}}

Component:
computer details:

using System;
using System.Collections.Generic;
using System.Text;
namespace computerdetails
{
public class co_det
{
int d;
string w;
public void detail3()
{
Console.WriteLine("SELECT YOUR DESIRED COMPUTER");
w=Console.ReadLine();
d=int.Parse(w);
switch (d)
{
case 1:
{
Console.WriteLine("YOU HAVE SELECTED DELL");
Console.WriteLine("ITEM ID:09");
Console.WriteLine("ITEM PRICE:34,000");
Console.WriteLine("MODEL:INSPIRON");
}
break;
case 2:
{
Console.WriteLine("YOU HAVE SELECTED HCL");
Console.WriteLine("ITEM ID:59");
Console.WriteLine("ITEM PRICE:24,000");
Console.WriteLine("MODEL:ASPIRE");
}
break;
case 3:
{
Console.WriteLine("YOU HAVE SELECTED LAVA");
Console.WriteLine("ITEM ID:05");
Console.WriteLine("ITEM PRICE:55,000");
Console.WriteLine("MODEL:LAVA");
}
break;

case 4:
{
Console.WriteLine("YOU HAVE SELECTED SONY");
Console.WriteLine("ITEM ID:75");
Console.WriteLine("ITEM PRICE:23,000");
Console.WriteLine("MODEL:DEVINE");
}
break;
case 5:
{
Console.WriteLine("YOU HAVE SELECTED SAMSUNG");
Console.WriteLine("ITEM ID:03");
Console.WriteLine("ITEM PRICE:65,000");
Console.WriteLine("MODEL:GALLERY");
}
break;
case 6:
break;
}}}}

Component:
customer:

using System;
using System.Collections.Generic;
using System.Text;
namespace customer
{
public class cus
{
string name;
string add;
 string phno;
string email;
public void display()
{
int q;
string v;
Console.WriteLine("if you have conformed with this product fill the customer form");
Console.WriteLine("1.yes/2.no");
v=Console.ReadLine();
q=int.Parse(v);
switch(q)
{
case 1:
{
Console.WriteLine("enter your name:");
name = Console.ReadLine();
Console.WriteLine("enter your address:");
add = Console.ReadLine();
Console.WriteLine("enter your phone number:");
phno = Console.ReadLine();
Console.WriteLine("enter your email id:");
email = Console.ReadLine();
Console.WriteLine("CHECK YOUR DETAILS");
Console.WriteLine("");
Console.WriteLine("NAME={0}", name);
Console.WriteLine("ADDRESS={0}", add);
Console.WriteLine("PHONE NUMBER={0}", phno);
Console.WriteLine("EMAIL ID={0}", email);
Console.WriteLine("");
Console.ReadLine();
}
break;
case 2:
break;
}}}}

Component:
order:

using System;
using System.Collections.Generic;
using System.Text;
namespace orderclass
{
public class Corder
{
int s;
string f;
public void display4()
{Console.WriteLine("select payment method");
Console.WriteLine("1.CHEQUE/2.CASH");
f = Console.ReadLine();
s = int.Parse(f);
switch (s)
{case 1:
{Console.WriteLine("enter your account no:");
Console.ReadLine();
Console.WriteLine("name of bank:");
Console.ReadLine();
Console.WriteLine("your order conformed");}
break;
case 2:
{Console.WriteLine("your order conformed");
}
break;
case 3:
break;
 }}}}


Component:
invoice:

using System;
using System.Collections.Generic;
using System.Text;
namespace invoice
{public class inv
{public void display5()
{Console.WriteLine("YOUR PRODUCT WILL BE DELIVERED ON 12.9.2011");
Console.ReadLine();

}}}






Sunday, 31 March 2013

Swapping Program Using C# - Swapping two values in C sharp

SWAPPING PROGRAM

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

namespace SwapUsingRef
{
    class swap
    {
        public void swapping(ref int var1, ref int var2)
        {
             int temp;
            temp = var1;
            var1 = var2;
            var2 = temp;
        }
    }


    class Program
    {
        static void Main(string[] args)
        {

            swap s = new swap();
            int num1 = 5;
            int num2 = 10;

            Console.WriteLine(" VALUES BEFORE SWAPPING \n A={0} and B={1} ", num1, num2);

            s.swapping(ref num1, ref num2);
            Console.WriteLine(" VALUES AFTER SWAPPING \n A={0} and B={0} ", num1, num2);

            Console.ReadLine();
        }
    }
}





C# (C Sharp) - Program to Check entered character is vowel or not vowel


PROGRAM TO IMPLEMENT VOWEL ( TO CHECK ENTERED CHARACTER IS VOWEL OR NOT)
ALSO TO CHECK No. Of VOWEL CHARACTER ENTERED

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

namespace vowel
{

    class Program
    {
        static void Main(string[] args)
        {

          
            int a=0, b=0;

            Console.WriteLine(" Enter the number of character  ");
            int tot = Convert.ToInt32(Console.ReadLine());

            char[] ch = new char[tot];
            Console.WriteLine(" Enter {0} Characters ", tot);

            for (int i = 0; i < tot; i++)
            {
                ch[i] = Convert.ToChar(Console.ReadLine());
            }

            for (int i = 0; i < tot; i++)
            {
                if (ch[i] == 'a' || ch[i] == 'e' || ch[i] == 'i' || ch[i] == 'o' || ch[i] == 'u' || ch[i] == 'A' || ch[i] == 'E' || ch[i] == 'I' || ch[i] == 'O' || ch[i] == 'U')
                {
                   
                    a++;
                }
                else
                {
                   
                    b++;
                }
            }

            Console.WriteLine(" No. of VOWEL is     {0}", a);
            Console.WriteLine(" No. of Non VOWEL is {0}", b);


            Console.ReadLine();



        }
    }
}







Back To Top