First class I have finished   Class Landingsport (self, ID, country, city)      self.ID= ID       self.country = country       self.city = city REPR Getters and setter done    ****but when I get to the other class I find issues

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Hey there I am struggle with importing a existing class in PYTHON  

 

(Landingspot CLASS with objects ID, city, country )and am trying to import to another class module PLANE(flightNumber, Start, goingTo). Each class would be eventually reading from text files with some spaces and commas separating randomly.

 

'Each Plane object must have a flightNumber (the unique 6-character code containing 3 letters followed by 3 digits), Start place, and a goingTo. Both the Start and goingTo must be LandingSpot objects within the program.'

 

Landingspot

Ex textfile contains

JFK,UnitedStates,   NewYork

PHL,UnitedStates,Philadelphia

etc

 

Class Plane EX text file contains

SVF907,MAA,IBN

MWD542,     TIP,YNR

etc

 

 

First class I have finished

 

Class Landingsport (self, ID, country, city)

     self.ID= ID

      self.country = country

      self.city = city

REPR

Getters and setter done 

 

****but when I get to the other class I find issues

 

Second class

*import from Landingspot as it makes use of Landingspot objects; add the line from Landingspot import *

 

__init__(self, flightNumber, Start, goingTo):

 First check that both Start and goingTo are Airport objects : use the isinstance operator).

If either or both are not Plane objects, raise a TypeError that states "The Start and goingTo must be plane objects"

 

 When the Start and goingTo are both Plane objects, proceed to initialize the instance variables _flightNumber, _start, and _goingTo based on the corresponding parameters in the constructor

 

  __repr__(self):

o Return the representation of this Plane  - containing the flightNo, origin city, and destination city, and an indication of whether the Flight is  international or domestic  (see the isDomesticFlight method description below). The representation must be in the following format: Plane: flightNumber from startCity to goingToCity {domestic/international}

 

EX Flight: MLK523 from London to Manchester {domestic}

EX  Flight: WBQ345 from London to Chicago {international}

 

 __eq__(self, other):

 Method that returns True if self and other are considered the same Flight: if the origin and destination are the same for both Flights. Make sure that if “other” variable is not a Flight object, this means False should be returned.

 

 getFlightNumber(self):

 Getter that returns the Flight number

 

getStart(self):

Getter that returns the Plane Start

 

 getgoingTo(self):

 Getter that returns the Plane destination

 

 isDomesticFlight(self): 

Method that returns True if the flight is domestic, EX within a country (the Start and goingTo are in the same country); returns False if the flight is international (the Start and goingTo are in different countries)

 

 setStart(self, origin):

Setter that sets (updates) the Plane Start

 

 setgoingTo(self, destination):

Setter that sets (updates) the Plane GoingTo

Expert Solution
steps

Step by step

Solved in 5 steps with 3 images

Blurred answer
Knowledge Booster
Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education