Thursday, 2 May 2013

Electricity calculate your own home program in c#

Electricity calculate your own home program in c#
Object


Create a class ElectricityBilling that contains a function which calculates total billing amount with the help of inputs and displays the yearly bill as well. Take name, consumer_id, consumer_type as input, where as pressure and consumed units are available by default as static members. Calculate the monthly bill based on the type of consumer. Also display the yearly bill. 



Code

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

namespace Atif
{



    class ElectricityBilling
    {
       static string name, consumerId, consumerType;
        static double pressure = 5.5;
        static  double consumerUnit=2.3;
        public static void totalBill()
        {

            Console.Write("Enter Your Name       ::  ");
           name= Console.ReadLine();
            Console.Write("Enter Consumer Id     ::  ");
            consumerId = Console.ReadLine();
            Console.Write("Enter consumer Type   ::  ");
            consumerType = Console.ReadLine();
           
            double Month =( pressure * consumerUnit) * 1;
            Console.WriteLine("Your Monthly  Bill is ::  "+Month);
            double Yearly = (pressure * consumerUnit) * 12;
            Console.WriteLine("Your Yearly Bill is   ::  "+Yearly);
           
           
        }

       
    }

        class Program
        {
         static  void Main(string[] args)
            {
                ElectricityBilling.totalBill();



            }
        }
    }

Screen Shor

3 comments: