Answered step by step
Verified Expert Solution
Question
1 Approved Answer
NOTE TO EXPERT: Please answer with a screenshot of the source code as it makes understanding the indentation a lot more easy. Abstract and Polymorphism
NOTE TO EXPERT: Please answer with a screenshot of the source code as it makes understanding the indentation a lot more easy.
Abstract and Polymorphism Abstraction allows a developer to design software better by thinking in general terms rather than specific terms while Polymorphism allows a developer to defer choosing the code you want to execute at runtime. The main purpose of abstraction is to hide unnecessary details from the users. Abstraction is selecting data from a larger pool to show only relevant details of the object to the user. It helps in reducing programming complexity and efforts. It is one of the most important concepts of OOPs. With polymorphism, a developer can define a single abstract class and reshape it in different ways to suit the methods and ideas. Your Assignment The Newwave Cell Phone Enterprise provides phone services for its customers. Create an abstract class named PhoneCall that includes a String field for a phone number and a double field for the price of the call. The class should include a constructor that requires a phone number parameter and that sets the price value to 0.0. Include a set method for the price. Also include three abstract get methods - one that returns the phone number, another that returns the price of the call, and a third that displays information about the call. Create two child classes of IncomingPhoneCall and OutgoingPhoneCall that will inherit class PhoneCall. The IncomingPhoneCall constructor passes its phone number parameter to its parent's constructor and sets the price of the call to 0.05. The method that displays the phone call information displays the phone number, the rate, and the price of the call (which is the same as the rate). The OutGoingPhoneCall class includes an additional field that holds the time of the call-in minutes. The constructor requires both a phone number and the time. The price is 0.02 per minute, and the display method shows the details of the call, including the phone number, the rate per minute, the number of minutes, and the total price. Write a driver program that demonstrates you can instantiate and display both InComingPhoneCall and OurGoingPhoneCall objects. Your driver program should assign data to a mix of 10 IncomingPhoneCall and OutGoingPhoneCall objects using Java ArrayList class. Use a loop concept to display the data. Save your program files as PhoneCall.java, IncomingPhoneCall.java, OutGoingPhoneCall.java, and PhoneCallArray.javaStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started