Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLEASE WRITE CODE IN PYTHON. You are writing a simple application to help Ernies Car Consignment, to keep track of his inventory. Ernie sells cars

PLEASE WRITE CODE IN PYTHON.

You are writing a simple application to help Ernies Car Consignment, to keep track of his inventory. Ernie sells cars and truck for their owner. The following diagrams describe the classes you will need for this project.

Vehicle

manufacturer

engineSize

owner

desiredPrice

__init__(manu, esize, name, price)

__str__()

setManu(manu)

setEng(esize)

setOwner(name)

setPrice(price)

getManu()

getSize()

getOwner()

regCost() #returns desiredPrice

totalCost()

^ ^

| | | | |

| |

Truck

Car

LoadCapacity

TowCapacity

Door

__init__(manu, esize, name, load, tow)

__str__()

setLoad(load)

setTow(tow)

getLoad()

getTow()

regCost() # returns selling price

__init__(manu, esize, name, doors)

__str__()

setDoor(door)

getDoor()

regCost() # returns selling price

Part I (20 points)

You will first need to code Person, Vehicle, Car and Truck class. As you can see, Vehicle is the base class from which the Truck and Auto classes inherit. The two derived classes describe two types of Vehicle. Note that the owner field is of class Person described by the diagram:

Person

Name

__init__(name = Nobody)

__str__()

setName(name)

getName()

The Vehicle class provides a constructor which initializes its instance data variables, in addition to accessor methods for each instance variable. Each of the subclasses provide additional data members specific to the type of Vehicle, plus additional methods needed to maintain the object. The desiredPrice is the price that the owner wants for the Vehicle.

Each of these classes provides a specific regCost method to compute the price the vehicle. Ernies pricing works as follows: each vehicle cost computation begins with the amount the owner wants for the vehicle. Ernie then adds 33% if it is a Car and 25% if it is a Truck. The totalCost for any vehicle is its regCost plus tax, which is 8.25%.

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

Visual C# And Databases

Authors: Philip Conrod, Lou Tylee

16th Edition

1951077083, 978-1951077082

More Books

Students also viewed these Databases questions

Question

Find the derivative. f(x) 8 3 4 mix X O 4 x32 4 x32 3 -4x - x2

Answered: 1 week ago

Question

Question How are IRAs treated for state tax law purposes?

Answered: 1 week ago