Provide public member functions that perform the given task

Assignment Help C/C++ Programming
Reference no: EM13708013

Question 1: Write the class definition for a class called complex.

Complex numbers have the form

        realPart + imaginaryPart * i

where I is the square of (-1)

Use double variable to show the private data of the class. Provide a constructor that enables an object of this class to be initialized when it is declared.

The constructor should contain default values of 0 in case no initializers are provided.

Provide public member functions that perform the given tasks:

Part 1: setComplex function to set complex number to set the real part and imaginary part of the complex number

Part 2: displayComplex function to print complex number in the form (a, b), where a is the real part and b is the imaginary part.

Question 2: Prepare a C++ program to test your class by using the given main function.

int main ()

{

complex c1(1, 2), c2(3, 4), c3;

c1.display();

c2.display()

c3.display();

c3.setComplex(5, 6);

c3.display();

return 0;

}

Can you show me how to write a proper code for these questions and how to complete it. Thanks

Reference no: EM13708013

Questions Cloud

Prepare the matlab script code : Prepare the MatLab Script Code written for - create a row array with m elements consisting of all the integers from 1 to m. Use disp to display the resulting array. For m, use 15.
What is the average queue occupancy : What is the average queue occupancy - What is the average delay of a bit in the queue?
What is the range of 4-bit signed integers : What is the range of 4-bit signed integers? Use the [M, N] notation where M represents the smallest and N represents the largest allowable integers.
Generate the k-map for this circuit : You can safely assume that the intruder will try to enter the house using only one of the three entrances. If any of the door or window is opened, you need to set the alarm signal to 1. A 0 means the door/window is closed and 1 means open.
Provide public member functions that perform the given task : Provide public member functions that perform the given tasks setComplex function to set complex number to set the real part and imaginary part of the complex number
Define a 5-elements array of complex number : Complex numbers have the form realPart + imaginaryPart * i. Both realPart and imaginaryPart are integers - Define a 5-elements array of complex number.
Provide the requested after values : Suppose the before values when the given instructions is executed. Provide the requested after values:
Why information systems today are currently effective : In a one to two page paper describe why information systems today are currently effective or ineffective in assisting with problem resolution in an organization.
Determine which number is smaller and which is larger : The program should use the conditional operator to determine which number is the smaller and which is the larger.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Define a class for a type called fraction

Define a class for a type called Fraction. This class is used to represent a ratio of two integers. Include mutator functions that allow the user to set the numerator and the denominator.

  Assignmentthe main purpose of the assignment is to let you

assignmentthe main purpose of the assignment is to let you practice the following programming techniques read data from

  Main program should instantiate an instance

The main program should instantiate an instance of the class Rectangle and then make calls to the member functions to input the data and output the results

  Uml diagram of all the classes

Speaking of converting into the correct object-type, the goal of the factory is to abstract away object creation.

  Write a program to find the area of a circle

Write a program to find the area of a circle. The program should use two procedures. The first procedure will print out the program heading and ask the user to enter the radius.

  Where can grep be found for windows for linux

What is grep? Where can grep be found for Windows? For Linux?

  In c++, write a program that calculates 10,000 tries.

In C++, write a program that calculates 10,000 tries. These tries are based upon a rat trying to escape from a maze. Keep adding minutes until the rat is free and when he is free that is 1 try so we need 10,000. We start by randomly generating a numb..

  Design a fraction class

Design a fraction class. The class should have 2 data members to represent the numerator and denominator. Both of these numbers should obviously be integers. It should be able to display a fraction and include an operator for performing multiplica..

  The imperial system of measurements

The Imperial system of measurements uses feet and inches for length, where 1 foot is equal to 12 inches. Write a class named Imperial that will represent distance measurements in feet and inches. Your class should include the following.

  C string and two int reference parameters

Write a complete function, not an entire program, that has a C string and two int reference parameters (call them a and b), returning nothing.

  Function odd_fill() that fills all integers between two poin

write a function odd_fill() that fills all integers between two pointers, first and last, with a sequence of odd integers: 1,3,5,7

  Ansi-c program complete assignment as follows in the

complete assignment as follows in the

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd