Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2.1 You Trylt: Static Electric Create the interface and classes shown below: > Electric Bill public static double murate puble double calent kwhx Regular Customer

image text in transcribed

image text in transcribed

2.1 You Trylt: Static Electric Create the interface and classes shown below: > Electric Bill public static double murate puble double calent kwhx Regular Customer PreferredCustomer Discount Customer public double calclint kwhx public double calcoint why public double calcoint kwhx IElectrical Your class should have the following behavior Regular Customer - This class should calculate the bill by multiplying the number of kwh by the static rate defined in DiscountCustomer - This class should calculate the bill by multiplying the number of kwh by the static rate defined in IElectrical and then discounting it by 25%. Preferred Customer - This class should calculate the bill by multiplying the number of kwh by the static rate defined in IElectricall and then discounting it by 50%. The rate in ElectricBill should be set to 0.21 I have provided you with a readonly Mainjava file that you can use to test your code LAB ACTIVITY 2.1.1: YOUTrylt Static Electric 0/10 Submission Instructions Downloadable files Main.jaza Download Compile command javac Main.java IElectricbi11.java Discount Customer.java Regular Customer.java Preferred Customer.java -Xlint:all -encoding utt- We will use this command to compile your code Upload your files below by dragging and dropping into the area or choosing a file on your hard drive. ElectricBill.java Discount Customer.java Regular Customerjava Drag file here Drag file here Drag file here Choose on hard drive Choose on hard drive Choose on hard drive. or or or Preferred Customer.java Drag file here Choose on hard drive or Main.java 1 limport java.util.*; 2 3 4 { 5 6 7 public class Main { public static void main(String args[]) { List bills = new ArrayList(); bills.add(new DiscountCustomer()); bills.add(new RegularCustomer()); bills.add(new Preferred Customer()); 8 11 12 System.out.printf("The base electric rate is %s%n", IElectricBill.m_rate); 13 14. 15 int count = 1; for (IelectricBill bill : bills) { System.out.printf("The total bill %d is $%.2f%n", count, bill.calc(231)); }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Bring out the limitations of planning.

Answered: 1 week ago

Question

Why should a business be socially responsible?

Answered: 1 week ago

Question

Discuss the general principles of management given by Henri Fayol

Answered: 1 week ago

Question

Detailed note on the contributions of F.W.Taylor

Answered: 1 week ago

Question

What are the Five Phases of SDLC? Explain each briefly.

Answered: 1 week ago

Question

How can Change Control Procedures manage Project Creep?

Answered: 1 week ago