Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Part A Please use the starter file as a hint file Complete the classes for ArraySet and LinkedSet, so they use inheritance to maximum advantage.
Part A
Please use the starter file as a hint file
Complete the classes for ArraySet and LinkedSet, so they use inheritance to maximum advantage.
Notes for Problem
Use starter file for the
arraysortedbag.py
linkedbag.py and
abstractbagpy files. In the ArraySet class of the
arrayset.py file, complete the following: Import the ArrayBag class from the
arraybag.py file. Modify the so that it contains the contents of sourceCollection from the ArrayBag class, if it's present. Modify the add method so that it uses the add method from ArrayBag if an item is not present. Remove any methods that are redundant from the ArraySet class. In the LinkedSet class of the
linkedset.py file, complete the following: Import the LinkedBag class from the
linkedbag.py file. Modify the initso that it contains the contents of sourceCollection from the LinkedBag class, if it's present. Modify the add method so that it uses the add method from LinkedBag if an item is not present.
Remove any methods that are redundant from the LinkedSet class. Be sure to retain in the ArraySet and LinkedSet class only those methods that cannot be moved to their parent class. To test your program run the test method in the
testset.py file.Complete the new class for sorted sets.
Complete the new class for sorted sets.
Notes for Problem
Be sure to reuse your solution from Problem as your starter file for the
arraysortedbag.py
linkedbag.py
abstractbagpy
arrayset.py and linke
dset.py files. Define def self sourceCollection None:
Define def addself item: To test your program run the run method in the
testset.py file.
Part B
Problem
Write a class named Car that has the following data attributes:
yearmodel for the car's year model
make for the make of the car
speed for the car's current speed
The Car class should have an method that accepts the car's year model and make as arguments. These values should be assigned to the object's yearmodel and make data attributes. It should also assign to the speed data attribute.
The class should also have the following methods:
accelerate
The accelerate method should add to the speed data attribute each time it is called.
brake
The brake method should subtract from the speed data attribute each time it is called.
getspeed
The getspeed method should return the current speed.
Next, design a program that creates a Car object then calls the accelerate method five times. After each call to the accelerate method, get the current speed of the car and display it Then call the brake method five times. After each call to the brake method, get the current speed of the car and display it
Problem
Write a class named Patient that has attributes for the following data:
First name, middle name, and last name
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