Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Implement a class Address. Prior to writing your program, use PowerPoint to draw a UML diagram of the class. An address has a house number,

Implement a class Address. Prior to writing your program, use PowerPoint to draw a UML diagram of the class. An address has a house number, a street, an optional apartment number, a city, a state and a postal code. Define the constructor such that an object can be created in one of two ways: with our without an apartment number. Supply a print method that prints the address with the street on one line and the city, state and postal code on the next line. Supply a method def comesBefore(self, other) that tests whether this address comes before other when compared by postal code. This method should return a boolean value. Develop your class in one file, and create a test file for testing your class.

I've started the code:

class Address: def __init__(self,apartmentNumber,street,state,city,postalCode): self.apartmentNumber = apartmentNumber self.stree = street self.state = state self.city = city self.postalCode = postalCode

def print(self): print(self.street) print(self.city,self.state,self.postalCode)

def comesBefore(self,other): return self.postalCode

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2014 Nancy France September 15 19 2014 Proceedings Part I Lnai 8724

Authors: Toon Calders ,Floriana Esposito ,Eyke Hullermeier ,Rosa Meo

2014th Edition

3662448475, 978-3662448472

More Books

Students also viewed these Databases questions