Roxanne A.

asked • 01/05/23

Can someone help explain this to me in a simple way? And provide a sample? Thanks!

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:

  1. name of the country (string data)
  2. population of the country (integer data)
  3. name of the country's capital (string data)
  4. population of the capital (integer data) 

The Country class should have:

  1. an initializing constructor. You can decide which properties are initialized.
  2. toString() method that prints the data for the country. You can decide on the format of the output.
  3.  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.


Judy R.

Hello I am 22 years experienced Online Tutor and Assignment Helper for Computer Science and Math. I have been teaching IT Professionals, students from different grades, and Graduate and Post Graduate students for more than 22 years. I am ready to help you with your learning requirements, assignments, tests, and projects. For further discussion about the assignment or project help you need, please add me on skype and my skype id is nettuitions Thanks
Report

01/22/23

2 Answers By Expert Tutors

By:

Hayward B. answered • 01/05/23

Tutor
0 (0)

python developer, software enginneer

Roxanne A.

the main.py file gives me an error
Report

01/13/23

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.