This program demonstrates Object-Oriented Programming (OOP) concepts such as class creation, inheritance, constructors, and method overriding. The program consists of a Mobile class and three subclasses, Android, iPhone, and BlackBerry.
Make sure to follow the Single Responsibility Principle and break each class into its own file.
Mobile ClassMobile.manufacture (String): Manufacturer name.operatingSystem (String): Operating system type.model (String): Model name.cost (double): Price of the mobile device.manufacture and operatingSystem.toString() method to return a formatted string of mobile details.Android SubclassAndroid that extends Mobile.super.toString() method to include Android Details.iPhone SubclassiPhone that extends Mobile.Android class.toString() method to include iPhone Details.BlackBerry SubclassBlackBerry that extends Mobile.Android class.toString() method to include BlackBerry Details.Main ClassMain class with a main() method.Mobile, Android, iPhone, and BlackBerry classes.printMobileDetails() that accepts a Mobile object and prints its details.printMobileDetails() for each object to demonstrate polymorphism.Enhance the program by creating a polymorphic method getDiscountedPrice() in the Mobile class that calculates a discount based on the device type. Override this method in the Android, iPhone, and BlackBerry subclasses to apply different discount rates. Test this method in the Main class by calling it polymorphically.
Manufacturer: Generic, OS: OS, Model: Basic Model, Cost: $500.0
Discounted Price: $475.0
Manufacturer: Samsung, OS: Android, Model: Galaxy S21, Cost: $1000.0 (Android Details)
Discounted Price: $900.0
Manufacturer: Apple, OS: iOS, Model: iPhone 13, Cost: $1200.0 (iPhone Details)
Discounted Price: $1080.0
Manufacturer: BlackBerry, OS: BB OS, Model: BlackBerry Key2, Cost: $800.0 (BlackBerry Details)
Discounted Price: $680.0