C# Cognizant Handson Solutions

Generate Bill Details Handson Solution Cognizant

Django multiplex is developing application for its cafeteria. The application should be able to calculate the bill details for the following scenario. You bought pizzas, puffs and cool drinks. Consider   the following prices :
    Rs.200/pizza
    Rs.40/puffs
    Rs.120/pepsi

Generate a bill.

The bill details must include the total cost of pizzas, total cost of puffs and total cost of pepsis. Calculate the grand total and display.

Display the GST and CESS amount. GST is 12% and CESS is 5% of the total price.

Sample Input 1:

Enter the number of pizzas bought : 5
Enter the number of puffs bought : 6
Enter the number of pepsi bought : 2

Sample Output 1:

Bill Details

Cost of Pizzas :1000
Cost of Puffs :240
Cost of Pepsis :240
GST 12% : 177.6
CESS 5% : 74
Total Price :1480

Program.cs

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

namespace ProgFundamentals2  //DO NOT change the namespace name
{
    public class Program      //DO NOT change the class name
    {
        public static void Main(string[] args)     //DO NOT change the 'Main' method signature
        {
            //Implement the code here
            int pizzaprice = 200;
            int puffprice = 40;
            int pepsiprice = 120;
            Console.WriteLine("Enter the number of pizzas bought :");
            int numpizza = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("Enter the number of puffs bought :");
            int numpuff = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("Enter the number of pepsi bought :");
            int numpepsi = Convert.ToInt32(Console.ReadLine());
            int pizzatotal = numpizza * pizzaprice;
            int pufftotal = puffprice * numpuff;
            int pepsitotal = pepsiprice * numpepsi;
            int total = pizzatotal + pufftotal + pepsitotal;
            double gst = 0.12 * total;
            double cess = 0.05 * total;
            Console.WriteLine();
            Console.WriteLine("Bill Details");
            Console.WriteLine();
            Console.WriteLine("Cost of Pizzas :" + pizzatotal);
            Console.WriteLine("Cost of Puffs :" + pufftotal);
            Console.WriteLine("Cost of Pepsis :" + pepsitotal);
            Console.WriteLine("GST 12% : " + gst);
            Console.WriteLine("CESS 5% : " + cess);
            Console.WriteLine("Total Price :" + total);
        }
    }
}

Similar Posts