Question
Before completing this assignment you should read through the document LCS Notes about Python Objects Download LCS Notes about Python Objects, look at the sample
Before completing this assignment you should read through the document LCS Notes about Python Objects Download LCS Notes about Python Objects, look at the sample programs that go with that document, and make sure you understand them.
Your tasks for this assignment are in two parts. You will need to create class definition of your own to keep track of the countries of the world, and use that definition is sample software, similar to the way the Book class is used in sample software in this module.
Part 1
First create a single .py file that contains both the Country class definition and then a main program that uses instances of that class, similar to the way classSample.py works. The Country class should have the following properties:
* 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.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started