Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CP1404/CP5632 Practical - Suggested Solution Programming Language class with tests. class ProgrammingLanguage: Represent information about a programming language. def __init__(self, name, typing, reflection,

""" CP1404/CP5632 Practical - Suggested Solution Programming Language class with tests. """ class ProgrammingLanguage: """Represent information about a programming language.""" def __init__(self, name, typing, reflection, year): """Construct a ProgrammingLanguage from the given values.""" self.name = name self.typing = typing self.reflection = reflection self.year = year self.PointerArithmetic = PointerArithmetic def __repr__(self): """Return string representation of a ProgrammingLanguage.""" return f"{self.name}, {self.typing} Typing, Reflection={self.reflection}, First appeared in {self.year}, {self.Pointer Arithmetic}" def is_dynamic(self): """Determine if language is dynamically typed.""" return self.typing == "Dynamic" def run_tests(): """Run simple tests/demos on ProgrammingLanguage class.""" ruby = ProgrammingLanguage("Ruby", "Dynamic", True, 1995) python = ProgrammingLanguage("Python", "Dynamic", True, 1991) visual_basic = ProgrammingLanguage("Visual Basic", "Static", False, 1991) languages = [ruby, python, visual_basic] print(python) print("The dynamically typed languages are:") for language in languages: if language.is_dynamic(): print(language.name) if __name__ == "__main__": run_tests()

Language,Typing,Reflection,Year,Pointer Arithmetic Java,Static,Yes,1995,NO C++,Static,No,1983,YES Python,Dynamic,Yes,1991,NO Visual Basic,Static,No,1991,NO Ruby,Dynamic,Yes,1995,NO

Modifications

Add another language to the file - and make sure it still works properly. Use data from this Programming Language Comparison page

Add another field to your ProgrammingLanguage class: Pointer Arithmetic (see that page or search to find if the language has it or not). This will be a Boolean variable. This may take a bit of effort, as you need to update the class and any code that uses it. You also need to add the correct values to your data file (in a form similar to reflection).

Check that your code is complete including updating any docstrings. Are __str__ and other methods complete and good?

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

Seven Databases In Seven Weeks A Guide To Modern Databases And The NoSQL Movement

Authors: Eric Redmond ,Jim Wilson

1st Edition

1934356921, 978-1934356920

More Books

Students also viewed these Databases questions