Polymorphism desing class called mobiledevice wich will inherent classes Tablet, Celular , Laptop. The class mobiledevice
Question:
Polymorphism
desing class called mobiledevice wich will inherent classes Tablet, Celular , Laptop.
The class mobiledevice will have as a attributes model,MemoyCapacity double ,keyboard and screen. Screen will be String
mobile device will have 2 constructors one empty and one wich wil allow to add values to the attributes. and also a Tostring method to return each device(Tablet, Cellular and laptop values.)
MobileDevice will be abstract and the methods getinput and set input will be abstract the method add() wich is not abstract will receive two arguments and will return the sum of both. getinput will return a string and set input will receive a string but no return
on the laptop class the method getinput will return the content of keyboard , and set input will save the string for inputscreen. The constructor will assign "Aspire One" as the model and 4.0 to memory capacity, Will have another constructor to modify the values of model and memory.
The tablet the method getinput() return the value of the keyboard and setinput will store a string on the keyboard. The constructor will assign "Nook" as a model and 16Gb of memory capacity. Wil have another constructor to modify the values of any of the attributes.
The celular class will have method getinput and will return the value of screen if the model is Iphone or Galaxy and also return the value of blackberry or sidekick if it have a physical keyboard the method setinput will save the value of "blackberry" or "SIdekick" the constructor will assign iphone to the model and 16 of memory capacity. will have another constructor to modify the values.
On the the Main will have an array of 2 objects from the class mobiledevice wich will have 2 objetcs from tablet , 2 objetcs from celular and 2 objetcs from laptop. Also on the main will demostrate that the set, gets and tostring from each class work.
Systems analysis and design
ISBN: 978-0136089162
8th Edition
Authors: kenneth e. kendall, julie e. kendall