First develop a single .py file that contains both the Country class definition and then a main
Fantastic news! We've Found the answer you've been seeking!
Question:
name of the country (string data)
population of the country (integer data)
name of the country's capital (string data)
population of the capital (integer data)
The Country class should have:
an initializing constructor. You can decide which properties are initialized.
a toString() method that prints the data for the country. You can decide on the format of the output.
at least two other methods, one of which should include input. For example, you could have a method that allows a user to update the population of a country, or any other property of the Country.
The software that uses instances of the class should create at least two different instances of a Country, and should include Python instructions testing all of the methods in your class and demonstrating that they work properly.
Part 2
You should decouple the software you created in Part 1 by putting the Class definition in its own file, with the software that uses instances of the class in a separate file, similar to the way myprogram.py uses bookClass.py. You do not need to create new software from scratch for this part of the assignment -- you can use the same software from Part 1, but it should be packaged in two different files.
Your software should be properly documented.
You should submit all three .py files -- the first file with both class definition and the software using instances of the class in the same file, and the two files with the same software using the class as a decoupled class. It is okay to upload all three files independently -- they do not need to be zipped together.
Related Book For
Posted Date: