Question: Git Repository and Development Environment You are required to: 1 . Create a new Git repository on sc - gitlab.ufv.ca named 2 0 2 4

Git Repository and Development Environment You are required to: 1. Create a new Git repository on sc-gitlab.ufv.ca named 202409comp150on2 assignment2. NB: corrected assignment4 to assignment2 above 2. Develop your code on ufv.syzygy.ca.3. Use SSH authentication for interacting with your Git repository. 4. Add the user janzenc as a developer to your repository. 5. Commit your work frequently with meaningful commit messages. 6. Submit your Git repository URL on Blackboard once completed. Problem Overview You will create two classes: A Rectangle class to model a rectangle with methods to calculate its area and perimeter. A Circle class to model a circle with methods to calculate its area and circumference. You will then instantiate both classes, set their properties, and display the calculated results. Instructions Part 1: Define the Rectangle Class (2 marks) Define a class named Rectangle. The class should have two private attributes: width and height (both default to 1.0).1 Include the following methods: init (self, width: float, height: float)- Constructor to Part 2: Part 3: initialize the width and height. get width(self)-> float - Returns the width. get height(self)-> float - Returns the height. set width(self, width: float)- Sets a new width (should vali- date that the width is positive). set height(self, height: float)- Sets a new height (should validate that the height is positive). calculate area(self)-> float - Returns the area of the rectan- gle (width \times height). calculate perimeter(self)-> float - Returns the perimeter of the rectangle (2\times (width + height)). Define the Circle Class (2 marks) Define a class named Circle. The class should have one private attribute: radius (default to 1.0). Include the following methods: init (self, radius: float)- Constructor to initialize the ra- dius. get radius(self)-> float - Returns the radius. set radius(self, radius: float)- Sets a new radius (should validate that the radius is positive). calculate area(self)-> float - Returns the area of the circle (\pi \times radius2). calculate circumference(self)-> float - Returns the circum- ference of the circle (2\times \pi \times radius). Instantiating and Testing the Classes (2 marks) Create an instance of the Rectangle class and set the width to 5.0 and the height to 3.0. Create an instance of the Circle class and set the radius to 4.0. Print the following details: The width, height, area, and perimeter of the rectangle. The radius, area, and circumference of the circle. 2 Part 4: Handling Invalid Input (1 mark) Modify the set width, set height, and set radius methods to raise a ValueError if a negative or zero value is passed. Expected Output Your program should produce output similar to the following: Rectangle width: 5.0 Rectangle height: 3.0 Area: 15.0 Perimeter: 16.0 Circle radius: 4.0 Area: 50.27 Circumference: 25.13 Submitting the Assignment 1. Push your final code to your Git repository on sc-gitlab.ufv.ca.2. Ensure that the user janzenc has been added as a developer on your repository. 3. Submit the repository URL in the Blackboard drop box. Criteria Part 1(2 marks): Class definition, methods, and validation for the Rectangle class. Part 2(2 marks): Class definition, methods, and validation for the Circle class. Part 3(2 marks): Instantiation and printing of the results for both classes. Part 4(1 mark): Handling of invalid input using exception

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!