17. Define a class Electricity Bill with the following specifications:
class
: Electricity Bill
Instance variables/data members:
String n
: stores the name of the customer
int units
: stores the number of units consumed
double bill : stores the amount to be paid
Member methods:
void accepto
: to the name of the customer and number of units consumed
void calculate() : to calculate the bill as per the following tariff:
Number of units
Rate per unit
2.00
First 100 units
Next 200 units
*3.00
Above 300 units
* 5.00
A surcharge of 2.5% charged if the number of units consumed is above 300 units.
void print)
: to prints the details as follows:
Name of the customer
Number of units consumed :
Bill amount
Write a main method to create an object of the class and call the above member
methods.
[ICSE 2017]
please answer this question by creating a java program
Answers
Answered by
34
Answer:
The java program is in the above picture
PLEASE MARK ME AS BRAINLEAST...
Attachments:
Similar questions