For all the problems in this assignment you need to design and use Python 3, output and present the results in nicely format. Please submit a written report (pdf), where your results and copy your code should be readable, and 4 python files (main.py, gen- erator.py, point.py and MCTest.py). Your grade will be evaluated by combination of report and code. You are strongly encouraged to write comment for your code, because it is a convention to have your code documented all the time. In your python file, you need contain both function and test part of function. Python script must be a ‘.py’ script, Jupyter notebook ‘.ipynb is not allowed. Do NOT copy and paste from others, all homework will be firstly checked by plagiarism detection tool.
1 Class practice 30 pts
1.1 Define class (20pts)
Create a class called Rectangular, with two data attributes: length and width. They should be assigned in constructor ( init ()) It should also have two function attributes called area() and perimeter() which return area and perimeter of this rectangular re- spectively. Here is an example of the class structure:
>>> class Rectangular:
>>> myRec = Rectangular(10,20)
>>> print(myRec.area()) 200
>>> print(myRec.perimeter()) 60
(5pt Bonus) Write an inherited class called Square from Rectangular, you may only override the constructor, let it only accept one parameter: length. You need to call its superclass’s constructor in its constructor, instead of assigning parameters to data attributes.
1.2 Numpy applying on class (10 pts)
define two numpy array with size 10, named with length and
test your your class ¡Rectangular¿ with input as np (Here you should have 10 output for area and perimeter).
2 Display Time (20pts)
Create a Time class and initialize it with hours, minutes and seconds.
Make a method addTime which should take two time object and add them. E.g. if your original initial parameter is (2 hour and 50 min and 10 seconds), then you could call this method with another input parameters (1 hr and 20 min and 5 seconds) , then output is (4 hr and 10 min and 15 seconds)
Make a method displayTime which should print the time (the initial parameter).
Make a method DisplayMinute which should display the total seconds in the Time. E.g.- (1 hr 2 min) should display 3720
3 Uniform Distributed Random Number Generator (50pt)
You can not use any random number generators in packages like Numpy, because you are required to build your own generator in this question.
Almost all the random numbers generated by computer are pseudo random num- bers, because they are generated by a formula. A good random number generator is very important for financial simulations, such as Monte-Carlo method.
The goal of this assignment is to let you understand how computer generate ran- dom numbers and create pseudo random number generators which can generate 0-1 uniform-distributed random numbers by yourselves.
DescriptionIn this final assignment, the students will demonstrate their ability to apply two majorconstructs of the C programming language – Fu
Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t
Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th
1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of
1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of