Given the following code segment. class Bike { private int wheels; public void setWheel(int wheel) { wheels = wheel; } public class BikeApp { public static void main() Bike bike1 = new Bike(); Bike...


Given the following code segment.<br>class Bike {<br>private int wheels;<br>public void setWheel(int wheel)<br>{ wheels = wheel; }<br>public class BikeApp {<br>public static void main()<br>Bike bike1 = new Bike();<br>Bike bike2 = new Bike(2);<br>bike1.setWheel(3);<br>a) Write two suitable constructors for class Bike. (2 marks)<br>b) Modify the above code necessarily. Then add code to displays on the screen the number of wheels for each object. (3 marks)<br>TTT Arial<br>: 3 (12pt)<br>:T E - E -.<br>Click Save and Submit to save and submit. Click Save All Answers to save all answers.<br>Save All Answers<br>Close Wind<br>

Extracted text: Given the following code segment. class Bike { private int wheels; public void setWheel(int wheel) { wheels = wheel; } public class BikeApp { public static void main() Bike bike1 = new Bike(); Bike bike2 = new Bike(2); bike1.setWheel(3); a) Write two suitable constructors for class Bike. (2 marks) b) Modify the above code necessarily. Then add code to displays on the screen the number of wheels for each object. (3 marks) TTT Arial : 3 (12pt) :T E - E -. Click Save and Submit to save and submit. Click Save All Answers to save all answers. Save All Answers Close Wind

Jun 03, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here