Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Given the following template of abstract superclass named Mobile Phone and subclasses named IPhone and Android: //serial number public abstract class Mobile Phone {
Given the following template of abstract superclass named Mobile Phone and subclasses named IPhone and Android: //serial number public abstract class Mobile Phone { protected String serial No; protected int capacity; } //phone storage: //32, 64, 128, 256 or 512 //eg 4000mAH //phone color protected int batteryLasting; protected String color; protected String datePurchased; //Methods: //constructors, accessor, printer //format dd/mm/yyyy public abstract double calPrice(); public class IPhone extends Mobile Phone private String type; private String category; //iphonell, iphone12 or iphone13 //standard, pro or pro max private boolean insurance; //true if taken the insurance //otherwise, false } //Methods: //constructors, accessor, printer public double calPrice() {} //calculate total price public class Android extends Mobile Phone { private String brand; private boolean dualSim; //Asus, Lenovo or Redmi //true if dual sim card //otherwise, false } //Methods: //constructors, accessor, printer public double calPrice() {...} //calculate total price a) Write the following method definition: i) Accessor methods that return every attribute in superclass. (5 marks)
Step 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