Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Need to write python programming for this structure. Do help with the solution. 4. a) Write a class definition for a Trapezium class. Variables The
Need to write python programming for this structure. Do help with the solution.
4. a) Write a class definition for a Trapezium class. Variables The Trapezium class should have variables for its base, top and height. Functions Write an init function that takes in 3 parameters and sets the base, top and height to these parameter values. In addition, the class should have a function that is capable of computing the area of a trapezium. Area of a trapezium = (base + top) * height/2 top ----- height base b) Write a Trapezium User python file to make use of the Trapezium class(which is created in the same TrapeziumUser python file). Your program should read in the Base, Top and Height and print out the area of trapezium. Note that you could read in the base with example code:base=float(input("Base:")) It would produce the following output assuming input values 4.5 for Base, 6 for Top and 5 for Height: Base: 4.5 Top:6 Height:5 26.25Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started