11import java.util.*;
22public class ElectBill
3- { //Creating Global Variables*/
3+ {
4+ //Creating Global Variables*/
45 int ConsumerNo; /* to store consumer no. globally*/
56 String ConsumerName; /* to store the name of the person*/
67 int PrevReading; /* to store previous reading globally*/
78 int CReading; /* to store current reading globally*/
89 String EBConn; /* to get the type of user*/
910 double Bill; /*to generate bill*/
1011
12+
1113 void input_data() /*void function to take inputs from the user*/
1214 {
1315 Scanner sc = new Scanner(System.in);
@@ -23,6 +25,7 @@ public class ElectBill
2325 EBConn = sc.next(); /*take input of type of user*/
2426 }
2527
28+
2629 double calculate_bill() /* this is a return type double function for calculation of bill*/
2730 {
2831 int CurrReading; /* to take the diffrence between the previous reading and the current reading*/
@@ -53,6 +56,7 @@ public class ElectBill
5356 }
5457 return Bill; /* will return the calculated to the global variable bill*/
5558 }
59+
5660 void display() /* printing the outputs */
5761 {
5862 System.out.println("----------------------------------");
@@ -67,6 +71,7 @@ public class ElectBill
6771 System.out.println("Total Amount(Rs.): "+Bill);
6872 }
6973}
74+
7075class ElectBillGen extends ElectBill /* class to call functions of another class */
7176{
7277 public static void main (String[] args) /* main function to call the other member functions*/
0 commit comments