Question: How to write the following two classes? LawnMower Class LawnMower - type: String - make: String +LawnMower(String: type) +LawnMower(String: type, String: make) +getMake( ): String
How to write the following two classes?


LawnMower Class LawnMower - type: String - make: String +LawnMower(String: type) +LawnMower(String: type, String: make) +getMake( ): String +getType(): String +setMake( String: make):void +setType(String: type): void +getInstructions( ): String +toString(): String Details: For the one argument constructor set the default value for make to "John Deere" The getInstructions( ) method will be abstract and will be over-ridden in the sub classes. For the toString( ) method, have the method return a String that reads "This is a type goes here lawn mower .The Sub Class Cordless Extend the super class LawnMower to make a sub-class called Cordlessjava. See the UML diagram below. - batteryType: String +Cordless( ) +Cordless(String: make, String: batteryType) +getBatteryType( ): String lsetBatteryType(String batteryType): void +getlnstructions(): String +toString( ): String Details: For the no-argument constructor, set the batteryType to lithium. This will call the one argument constructor from the parent class. You need to implement the abstract method getInstructions( ) in this sub class. This method will return the operating instructions for the cordless lawn mower. Use your own words to describe how the lawn mower will function. For the toString( ) method of the Cordless class, have the method make a call to the super class toString( ) method, and then concatenate onto the string from the super class this string : This lawn mower will run for 2 hours on a single charge. So, if you had a Cordless object called cordlessMower and it called it's toString( ) method, the string returned should read This is a cordless lawn mower. This lawn mower will run for 2 hours on a single charge
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
