Likes

C# LAB at HoM 10

David needs to create a program to maintain the details of the stock of a shop. He needs to ensure that item category is Women, Men, Girls, Boys, and Babies. He needs to accept item category from the user. In addition, he needs to accept item name, number of units, and unit price. Finally, he needs to display all the details.

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

namespace ConsoleApplication27
{
    class shop
    {
        string item;
        int up, total, unit;
        public void accept()
        {
            Console.WriteLine("Enter the item name:");
            item = Convert.ToString(Console.ReadLine());
            Console.WriteLine("Enter units of item:");
            unit = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("Enter the unnit price:");
            up = Convert.ToInt32(Console.ReadLine());

        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            string cat;
            shop s = new shop();
            Console.WriteLine("Enter the catagory:");
            cat = Convert.ToString(Console.ReadLine());
            switch (cat)
            {
                case "women":
                    s.accept();
                    break;
                case "men":
                    s.accept();
                    break;
                case "girls":
                    s.accept();
                    break;
                case "boys":
                    s.accept();
                    break;
                case "babies":
                    s.accept();
                    break;
                default:
                    Console.WriteLine("Invalid Selection");
                    break;
            }
            Console.ReadLine();
        }
    }
}






No comments: