- 1

Develop a Java application to generate Electricity bill. Create a class with the following members: Consumer no., consumer name,

Develop a Java application to generate Electricity bill. Create a class with the following members: Consumer no., consumer name, previous month reading, current month reading, type of EB connection (i.e domestic or commercial). Compute the bill amount using the following tariff. If the type of the EB connection is domestic, calculate the amount to be paid as follows:  First 100 units - Rs. 1 per unit  101-200 units - Rs. 2.50 per unit  201 -500 units - Rs. 4 per unit  > 501 units - Rs. 6 per unit If the type of the EB connection is commercial, calculate the amount to be paid as follows:  First 100 units - Rs. 2 per unit  101-200 units - Rs. 4.50 per unit  201 -500 units - Rs. 6 per unit  > 501 units - Rs. 7 per unit

23rd Sep 2020, 5:22 AM
Milan Mohan
Milan Mohan - avatar
3 odpowiedzi
0
Its not my home work im not getting the output i have the program with me but not getting crt output
23rd Sep 2020, 5:32 AM
Milan Mohan
Milan Mohan - avatar
0
import java.util.*; class customerdata { Scanner in = new Scanner(System.in); Scanner ins = new Scanner(System.in); String cname,ctype; int bn; double current,previous,tbill,units; void getdata() { System.out.print ("\n\t Enter consumer number "); bn = in.nextInt(); System.out.print ("\n\t Enter Type of connection (D for Domestic or C for Commercial) "); ctype = ins.nextLine(); System.out.print ("\n\t Enter consumer name "); cname = ins.nextLine(); System.out.print ("\n\t Enter previous month reading "); previous= in.nextDouble(); System.out.print ("\n\t Enter current month reading "); current= in.nextDouble(); } void calc() { units=current-previous; if(ctype.equals("D")) { if (units<=100) tbill=1 * units; else if (units>100 && units<=200) tbill=2.50*units; else if(units>200 && units<=500) tbill= 4*units; else tbill= 6*units; } else { if (units<=100) tbill= 2 * units; else if(units>100 && units<=200) tbill=4.50*units; else if(units>200 && units<=500) tbill= 6*units; else tbill= 7*units; } } void display
23rd Sep 2020, 6:31 AM
Milan Mohan
Milan Mohan - avatar
0
Only giving errors not output
13th Dec 2022, 12:26 AM
Dakkili Kalyan
Dakkili Kalyan - avatar