Program of Shopping Having Special Discounts

C Sharp is usually known as C#. This Language is basically the Programming Language which is mainly used for object orientation. this language was developed by Microsoft. i personally feel that many people face problem while writing such codes for particular program. So, that is the reason i decided to create C Sharp problem resolving  post for that type of people. Here is a main program where approximately every beginner stuck. I am Faisal Mukhtar, Software Engineer. May be this post is helpful for you.

Question:

Make a game in C#, in which you can input total number of items, you wanna buy and then write their names along with their price. If you are a Senior Citizen, we will give you 30 % Discount. if not, and you buy from our Shopping center more than 50,000 and within 1,00,000, So we will also give you  20 % Discount and if you buys products more than 1,00,000 $ , then we will give you 30 % discount. 

int numitem, price = 0;
            double totalprice = 0;
       
            Console.WriteLine("Enter Number of Item(s): ");
            numitem = Convert.ToInt32(Console.ReadLine());
            for(int i=1;i<=numitem;i++)
            {
                Console.WriteLine("Enter Item Name: ");
                string itemname = Console.ReadLine();
                Console.WriteLine("Enter Item Price: ");
                price = int.Parse(Console.ReadLine());
                totalprice += price;
            }
            Console.WriteLine();
            Console.WriteLine("Are you Senior Citizen : \nif Yes press 1\t\tif No press 0");
            int Senior = int.Parse(Console.ReadLine());
            if(Senior==1)
            {
                totalprice = totalprice - (totalprice * 0.3);
                Console.WriteLine("You have to pay " + totalprice + " Rupees.");
            }
            else if(Senior==0)
            {
                if(totalprice >= 50000 && totalprice <= 100000)
                {
                    totalprice = totalprice - (totalprice * 0.2);
                    Console.WriteLine("You have to pay " + totalprice + " Rupees.");
                }
                else if(totalprice>100000)
                {
                    totalprice = totalprice - (totalprice * 0.3);
                Console.WriteLine("You have to pay " + totalprice + " Rupees.");
                }
                else
                    {
                        Console.WriteLine("You have to pay " + totalprice + " Rupees.");
                    }
                }
            }


Output:

Program of Shopping Having Special Discounts

Faisal Mukhtar

Assalam u Alaikum. I am web Developer, Web Application Developer, Web Designer, Free Lancer, Intro and outro maker, Logo Designer. If you like my work, so kindly give your feedbacks and intouch with me through my Social Links. Thank You