Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Implementation s = Truck(6, 10000, 'MTVR', '2500', 2014,12/12/12,15000) t = Truck(6, 10000, 'MTVR', '2500', 2014,None,15000) u = Car(4, 10000, 'Honda', 'Accord', 2014,None,10000) v = Car(4,

image text in transcribed

Implementation

s = Truck(6, 10000, 'MTVR', '2500', 2014,12/12/12,15000)

t = Truck(6, 10000, 'MTVR', '2500', 2014,None,15000)

u = Car(4, 10000, 'Honda', 'Accord', 2014,None,10000)

v = Car(4, 10000, 'Honda', 'Accord', 2014,10/12/12,10000)

print ("Purchase price of Truck is ",s.purchase_price())

print ("Sale price of Truck is ",s.sale_price())

print ("Purchase price of Truck is ",t.purchase_price())

print ("Sale price of Truck is ",t.sale_price())

print ("Purchase price of Car is ",u.purchase_price())

print ("Sale price of Car is ",u.sale_price())

print ("Purchase price of Truck is ",v.purchase_price())

print ("Sale price of Truck is ",v.sale_price())

(please use python to program thank you)

Class variables base sale price - 0 Instance variables Attributes: wheels: An integer representing the number of wheels the car has. miles: The integral number of miles driven on the vehicle. make: The make of the vehicle as a string. model: The model of the vehicle as a string. year: The integral year the vehicle was built. sold on: The date the vehicle was sold. Constructor Vehicle arguments: wheels, miles, make, model, year, sold_on State change: A new object of type Car is created. Return: That newly created Car object. Methods sale price No arguments Return: If the date is not none, Return the sale price for this vehicle by an agent as a float amount. Assume the sale price is $6000 per wheels purchase price No arguments. Return: Return the price for which agent would pay to purchase the vehicle. The vehicle would be purchased by an agent for pase sale price - (.10 miles) Now create a Car subclass and Truck subclass for Vehicle parent class. Constructor arguments: wheels, miles, make, model, year, sold on, base_sale price State change: A new object is created. Return: That newly created object

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_2

Step: 3

blur-text-image_3

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

Informix Database Administrators Survival Guide

Authors: Joe Lumbley

1st Edition

0131243144, 978-0131243149

More Books

Students also viewed these Databases questions