Te damos la bienvenida a nuestro sitio, ahora vas a hallar la solucíon que buscas.
Ejemplo: programa C# para calcular la factura de la luz
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
public class exercise18
static void Main(string[] args)
int custid, conu;
double chg, surchg=0, gramt,netamt;
string connm;
Console.Write("nn");
Console.Write("Calculate Electricity Bill:n");
Console.Write("----------------------------");
Console.Write("nn");
Console.Write("Input Customer ID :");
custid= Convert.ToInt32(Console.ReadLine());
Console.Write("Input the name of the customer :");
connm= Console.ReadLine();
Console.Write("Input the unit consumed by the customer : ");
conu= Convert.ToInt32(Console.ReadLine());
if (conu <200 )
chg = 1.20;
else if (conu>=200 && conu<400)
chg = 1.50;
else if (conu>=400 && conu<600)
chg = 1.80;
else
chg = 2.00;
gramt = conu*chg;
if (gramt>300)
surchg = gramt*15/100.0;
netamt = gramt+surchg;
if (netamt < 100)
netamt =100;
Console.Write("nElectricity Billn");
Console.Write("Customer IDNO :0n",custid);
Console.Write("Customer Name :0n",connm);
Console.Write("unit Consumed :0n",conu);
Console.Write("Amount Charges @Rs. 0 per unit :1n",chg,gramt);
Console.Write("Surchage Amount :0n",surchg);
Console.Write("Net Amount Paid By the Customer :0n",netamt);
Recuerda que te damos el privilegio agregar una reseña .
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)