Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Topics: class, method, object instantiation, inheritance, print Problem Statement: In this assignment, you will design one child class 'MountainBike' of a parent class 'Bicycle'. The

image text in transcribed

image text in transcribed

Topics: class, method, object instantiation, inheritance, print Problem Statement: In this assignment, you will design one child class 'MountainBike' of a parent class 'Bicycle'. The purpose of this lab is to gain experience in python's basic inheritance lass Definition: Bicycle Class (Parent class This class will have following instance variables and methods. Most Definition is provided in the template file. Attribute name/Instance varibales gear speed Data type Description int float Gear number includes 1-3 Speed of the cycle in mile per hour Method name Parameter gear, speed decrement Return type Description Initialize the instance attributes Decrease the speed by 'decrement variable init none applyBrake none Increase the speed by increment variable speedUp increment none Your Task: Design a MountainBike Class (Child class) with the following instance variables and methods Attribute name/Instance variables gear speed seatHeight Data type int float float Description Gear number includes 1-3 Speed of the cycle in mile per hour Height of the seat in cm Method name Parameter gear, speed, seatHeight none Return type none string Description Initialize the instance attributes Returns the current information of object. See sample lI/O Set the seatHeight to 'newValue' init str setHeight newValue none Object Creation/Instantiation: You need to create two objects m1' and 'm2' of 'MountainBike, class. Sample code has been provided in the template file. Sample output Object m1 No of gear: 3 Current speed: 10 Current seat height: 100 Object m2 No of gear: 2 Current speed: 5 Current seat height: 90 No of gear: 2 Current speed: 5 Current seat height: 76

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatial Databases A Tour

Authors: Shashi Shekhar, Sanjay Chawla

1st Edition

0130174807, 978-0130174802

More Books

Students also viewed these Databases questions

Question

What do you need to know about your students to motivate them?

Answered: 1 week ago