** Using Python 3 **
Write a Box class whose init method takes three parameters and uses them to initialize the length, width and height of a Box. It should also have a method named volume that returns the volume of the Box. Write a function named box_sort (not part of the Box class) that uses insertion sort to sort a list of Boxes from greatest volume to least volume.

code:
class Box:
def __init__(self,l,w,h):
self.length = l
self.width = w
self.height = h
def getVolume(self):
return self.length * self.width * self.height
def box_sort(boxes):
#traverse through each box object
for i in range(1, len(boxes)):
box = boxes[i]
#move the boxes from 0 to i-1 index which have greater
#volume than the current box
j = i-1
while j >=0 and box.getVolume() > boxes[j].getVolume() :
boxes[j+1] = boxes[j]
j -= 1
boxes[j+1] = box
return boxes
def main():
#create boxes and sort them
box1 = Box(4,6,2)
box2 = Box(1,2,3)
box3 = Box(3,4,6)
boxes = box_sort([box1,box2,box3])
for i in range(len(boxes)):
print(boxes[i].getVolume())
main()
** Using Python 3 ** Write a Box class whose init method takes three parameters and...
Use Python 3.7 to Write a function called volume_of_box() that takes three parameters (the length, width, and height of the box) and returns the volume of the box. Then, use that function in a program which prompts the user to enter the dimensions of a box and returns the volume. Your program should include input validation to ensure that the values entered are positive and should be able to accept float values. Many thanks for all your time and effort...
1) Translate the following equation into a Python assignment statement 2) Write Python code that prints PLUS, MINUS, O ZERO, depending on the value stored in a variable named N. 3) What is printed by: 3 - 1 while 5: while 10 Print ) Page 1 of 9 4) Write a Python while loop that reads in integers until the user enters a negative number, then prints the sum of the numbers. 1-2 of 9 4) Write a Python while...
Design of the Box Class. Objects of this class will represent a box (such as a cardboard box.) The sides of a box are rectangles. A Box will have three essential characteristics: width, height, and length. From these characteristics other values may be calculated: volume and total surface area. Complete the Constructors. The constructors will initialize the instance variables of the object being constructed. You need to pass three parameters to initialize the three instance variables. Complete a Method. The...
Python Write a function (named largest_of_three) that takes three parameters and returns the largest. You can assume the parameters are either floats or ints.
Write a class named HalfOpenCylinder that has two data members: a double for the height in inches and a double for the radius in inches. It should have a constructor that takes two parameters and uses them to initialize the data members. It should have a default constructor that initializes the height to 10 and the radius to 2. It should have a method named surfaceArea that returns the the surface area (in square inches) of a cylinder with that...
In Python 3 Write a LinkedList method named contains, that takes a value as a parameter and returns True if that value is in the linked list, but returns False otherwise.
Write a class called Person that has two private data members - the person's name and age. It should have an init method that takes two values and uses them to initialize the data members. It should have a get_age method. Write a separate function (not part of the Person class) called basic_stats that takes as a parameter a list of Person objects and returns a tuple containing the mean, median, and mode of all the ages. To do this,...
Python Implement a class named BubbleStringList. In this class implement a method called add, that when given a string, it adds it to an internal list object. You can use the list object from the standard python library for the internal list. Next, implement a sort method that uses a BubbleSort to sort the list when called. Create another class called MergeStringList, that implements the same methods but uses a Merge Sort as the sorting algorithm. Create another class called...
Write a class named Taxicab that has three private data members: one that holds the current x-coordinate, one that holds the current y-coordinate, and one that holds the odometer reading (the actual odometer distance driven by the Taxicab, not the Euclidean distance from its starting point). The class should have an init method that takes two parameters and uses them to initialize the coordinates, and also initializes the odometer to zero. The class should have get members for each data...
Write a function updateAges(names, ages) that takes as parameters a list of names of people whose birthday it is today and a dictionary named ages, with names as keys and ages as values, and increments the age of each person in the dictionary whose birthday is today.