logo Use SA10RAM to get 10%* Discount.
Order Now logo

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Earle BirdsellBusiness
(5/5)

504 Answers

Hire Me
expert
Satyender ReddyAccounting
(5/5)

660 Answers

Hire Me
expert
Lesley RobertsGeneral article writing
(5/5)

858 Answers

Hire Me
expert
Carlos HowarddEconomics
(5/5)

826 Answers

Hire Me
Python Programming

Create a class called Rectangular, with two data attributes: length and width. They should be assigned in constructor

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

Submission Requirement:

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)

  1. define two numpy array with size 10, named with length and

  2. 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.

  1. 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)

  2. Make a method displayTime which should print the time (the initial parameter).

  3. 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.

Related Questions

. The fundamental operations of create, read, update, and delete (CRUD) in either Python or Java

CS 340 Milestone One Guidelines and Rubric  Overview: For this assignment, you will implement the fundamental operations of create, read, update,

. Develop a program to emulate a purchase transaction at a retail store. This  program will have two classes, a LineItem class and a Transaction class

Retail Transaction Programming Project  Project Requirements:  Develop a program to emulate a purchase transaction at a retail store. This

. The following program contains five errors. Identify the errors and fix them

7COM1028   Secure Systems Programming   Referral Coursework: Secure

. Accepts the following from a user: Item Name Item Quantity Item Price Allows the user to create a file to store the sales receipt contents

Create a GUI program that:Accepts the following from a user:Item NameItem QuantityItem PriceAllows the user to create a file to store the sales receip

. The final project will encompass developing a web service using a software stack and implementing an industry-standard interface. Regardless of whether you choose to pursue application development goals as a pure developer or as a software engineer

CS 340 Final Project Guidelines and Rubric  Overview The final project will encompass developing a web service using a software stack and impleme

Get Free Quote!

266 Experts Online