See Exercise 9.15 in the Chapter 9 Programming Exercise from the Book section for the description of this exercise.
Sample Run
Enter the real part of the first complex number: 3.5
Enter the imaginary part of the first complex number: 6.5
Enter the real part of the first complex number: -3.5
Enter the imaginary part of the first complex number: 1
(3.5 + 6.5i) + (-3.5 + 1i) = (0.0 + 7.5i)
(3.5 + 6.5i) - (-3.5 + 1i) = (7.0 + 5.5i)
(3.5 + 6.5i) * (-3.5 + 1i) = (-18.75 - 19.25i)
(3.5 + 6.5i) / (-3.5 + 1i) = (-0.43396226415 - 1.98113207547i)
|(3.5 + 6.5i)| = 4.47213595499958.
In Python.
Code:
import math
#taking inputs for two complex numbers
r1=input("Enter the real part of the first complex number: ")
i1=input("Enter the imaginary part of the first complex number:
")
r2=input("Enter the real part of the second complex number:
")
i2=input("Enter the imaginary part of the second complex number:
")
#addition of two complex numbers
def add(r1,i1,r2,i2):
return r1+r2,i1+i2
#substraction of two complex numbers
def sub(r1,i1,r2,i2):
return r1-r2,i1-i2
#multiplication of two complex numbers
def mul(r1,i1,r2,i2):
return (r1*r2-i1*i2),(r1*i2+i1*r2)
#division of two complex numbers
def div(r1,i1,r2,i2):
r=(r1*r2+i1*i2)/(r2*r2+i2*i2)
i=(i1*r2-r1*i2)/(r2*r2+i2*i2)
return r,i
#absolute value of complex number
def abslt(r,i):
return math.sqrt(r*r+i*i)
#printing result
def prnt(r1,i1,r2,i2,r,i,c):
print("(%.2f + %.2fi) %c (%.2f + %.2fi) = (%.2f +
%.2fi)")%(r1,i1,c,r2,i2,r,i)
r,i=add(r1,i1,r2,i2)
prnt(r1,i1,r2,i2,r,i,'+')
r,i=sub(r1,i1,r2,i2)
prnt(r1,i1,r2,i2,r,i,'-')
r,i=mul(r1,i1,r2,i2)
prnt(r1,i1,r2,i2,r,i,'*')
r,i=div(r1,i1,r2,i2)
prnt(r1,i1,r2,i2,r,i,'/')
val=abslt(r1,i1)
print("|(%.2f + %.2fi)| = %f")%(r1,i1,val)
OUTPUT:

See Exercise 9.15 in the Chapter 9 Programming Exercise from the Book section for the description...
JAVA PROGRAMMING
A complex number is a number in the form a + bi, where a and b are real numbers and i is V-1. The numbers a and b are known as the real part and imaginary part of the complex number, respectively. You can perform addition, subtraction, multiplication, and division for complex numbers using the following formulas: a + bi + c + di = (a + c) + (b + di a + bi - (c +...
A complex number is a number in the form a + bi, where a and b
are real numbers and i is sqrt( -1). The numbers a and b are known
as the real part and imaginary part of the complex number,
respectively.
You can perform addition, subtraction, multiplication, and division
for complex numbers using the following formulas:
a + bi + c + di = (a + c) + (b + d)i
a + bi - (c + di)...
I am trying to complete Chapter 9 exercise 9 in C# Programming: From Problem Analysis to Program Design. I have both first name and last name textboxes, an account number textbox, and an initial balance textbox. I need to make error messages when the user doesnt enter their info, but can't figure out the if statements that i need to use. What would you suggest? Thanks
File Encryption and Decryption chapter 9 programming exercise #3 Design and write a python program to successfully complete chapter 9 programming exercise #3. File Encryption and Decryption Write a program that uses a dictionary to assign “codes” to each letter of the alphabet. For example: codes = { ‘A’ : ‘%’, ‘a’ : ‘9’, ‘B’ : ‘@’, ‘b’ : ‘#’, etc . . .} Using this example, the letter A would be assigned the symbol %, the letter a would...
2. Enter, compile, and run Program 11.1. he same name as the ave a return type nction as a member Chapter 11 Program 11.1 of this function the parameters include <iostream ing namespace std. *onging to the declaration section class Complex private: 1 double realPart; I notice the colon after the keyword pri eters, real ssigns the he func- ouble imaginary Part; maginaryPart. // function prototypes data // data member the key as also public: 11 again, notice the colon...
This should be a python project.I need help with programming project in python. Here are the instructions: (75 points) Program runs successfully (10 points) Inputs weight from the user using a Scanner object. (5 points) Outputs all drink options in simple format (10 points) Inputs drink choices from the user using a Scanner object (5 points) Repeats until -1 is entered (45 points) Outputs the final summary correctly (25 points) Program contents follow readability standards including: (15 points) Correct use...
Python Programming Chapter 5 Programming Exercise Dinner Selection Program (60 points total) Pseudocode (10 points) As the family cook, you know that the toughest question of the day is "What's for dinner?" You For decide to write a program to help you do days of meal planning for the entree, side and dessert. You will need to use random numbers and functions to complete the project. What's Dinner? • • • Start with a pseudocode (10 points). Write the pseudocode...
The program is described in Chapter 9, Exercise 11, in Programming Logic and Design. In this program, you should include two overloaded methods named computeRate(). One version accepts a number of days and calculates the rate at $99.99 per day. The other accepts a number of days and a code for a meal plan. If the code is A, three meals per day are included, and the price is $169.00 per day. If the code is C, breakfast is included,...
Chapter 8 Exercise 36, Introduction to Java Programming, Tenth Edition Y. Daniel LiangY. 8.36 (Latin square) A Latin square is an n-by-n array filled with n different Latin letters, each occurring exactly once in each row and once in each column. Write a program that prompts the user to enter the number n and the array of characters, as shown in the sample output, and checks if the input array is a Latin square. The characters are the first n...
FULL SCREEN PRINTER VERSION RACK NEXT Chapter 3, Section 1, Exercise 024 Topical Painkiller Ointment The use of topical painkiller ointment or gel rather than pills for pain relief was approved just within the last few years in the US for prescription use only. Insurance records show that the average copayment for a month's supply of topical painkiller ointment for regular users is $30. A sample of size 75 regular users found a sample mean copayment of $27.90 Tarkan, L.,...