Answered step by step
Verified Expert Solution
Question
1 Approved Answer
First develop a single .py file that contains both the Country class definition and then a main program that uses instances of that class, similar
First develop 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.
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.
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.
Step by Step Solution
★★★★★
3.36 Rating (149 Votes )
There are 3 Steps involved in it
Step: 1
Countrypy class Country This class represents a country def initself name population capital capitalpopulation Initialize the countrys properties self...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