Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Students also viewed these Databases questions

Question

6. Explain the power of labels.

Answered: 1 week ago

Question

5. Give examples of variations in contextual rules.

Answered: 1 week ago

Question

f. What stereotypes were reinforced in the commercials?

Answered: 1 week ago