Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using Python. New lab: Previous lab: Due: Due in lab In-lab assignment # 2 Topics: class, object, instantiation, print, looping, methods Problem Statement: As a

Using Python.
New lab:
image text in transcribed
Previous lab:
image text in transcribed
Due: Due in lab In-lab assignment # 2 Topics: class, object, instantiation, print, looping, methods Problem Statement: As a continuation to the previous lab assignment, you will design one method to find the absolute value of a complex number Lab Scenario: 1. 2. You first ask for the 'count' of the number of complex numbers the user want to process. You would then ask for user inputs a and b using the input function. According to the definition a, b are real numbers. You do not need to manipulate i since it's an imaginary part and there is no real solution for this part. The program will take the input, instantiate ComplexNumber object and then call the absolute method to calculate the absolute value and then print the result to the standard output. The program will repeat asking for the a,b and calculate and print the abs value for the count' number of times (see step 1) You can use the class definition from your first ILA. 3. 4. 5. Absolute Value of a Complex Number: The absolute value of a complex number, atib is defined as the distance between the origin (0,0)(0,0) and the point (a,b) in the complex plane. The formula is: Lab Procedure: 1. Prior starting of the work consider what is the information you need: what the output and what the input would be 2. Determine the steps to translate the code into the python class syntax 3. Test the application by giving some user input. Sample input/output: (Blue is user inpout) How many complex numbers you want to manipulate: 2 Complex number 1 Enter a: 2 Enter b:3 The absolute value of 2 i3 is 3.61 Complex number2 Enter a: 4 Enter b: 0 The absolute value of 4 i0 is 4.00

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

Students also viewed these Databases questions

Question

4. What sales experience have you had?

Answered: 1 week ago