Use double variable to represent the private data of class

Assignment Help Basic Computer Science
Reference no: EM13219818

Write the class definition for a class called complex. Complex numbers have the form realPart + imaginaryPart * i where I is the square of (-1) if " i " is square of " -1 then " i " = 1 Use double variable to represent 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 following tasks: a). setComplex function to set complex number to set the real part and imaginary part of the complex number b). displayComplex function to print complex number in the form (a, b), where a is the real part and b is the imaginary part. PART 2 . Write a C++ program to test your class by using the following 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; }

Reference no: EM13219818

Questions Cloud

Calculate population increase : The output then would be that count. You will want to use 2 variables, one for the index of the for loop ( and the counter in the do loop) and the other variable to keep track of your "current" population.
Synthesise theories and models from the module readings : Synthesise theories and models from the module readings and literature and utilise effective discussion, analysis and conclusions showing critical thinking to propose solutions
What will be the effect of an increase of 10dollar per unit : Suppose that a perfectly competitive consant cost industry if initially in short and long-run equilibrium. In general, what will be the effect of an increase of $10 per uni in varialbe coss on he short-run equilibrium price, the short-run industry..
How much total profit is the firm earning at the price : Suppose a monopolist charges a price of $27 for its product and sells 10 units at that price. At 10 units of production the firm has average fixed cost equal to $10 and average variable cost equal to $12. How much total profit is the firm earning ..
Use double variable to represent the private data of class : Use double variable to represent the private data of the class. Provide a constructor that enables an object of this class to be initialized when it is declared.
What the game theory matrix looks like without the law : Using a traditional game theory 2x2 matrix, show how this law prevents a prisoner's dilemma and thereby actually makes models better off. In other words, show what the game theory matrix looks like without this law.
Project portfolio management and business strategy : Discuss the linkage between project portfolio management and business strategy with your organisation (current or past). Explain the problems the organisation encounters.
Why did tomato fest suffer an economic loss : Fierce storms in October 2004 caused Tomato Fest Organic Heirlooms Farm to end its tomato harvest two weeks early. According to Gary Ibsen, a partner in this small business (Carolyn said, "Tomatoes in Trouble," San Francisco Chronicle, October 29,..
What happened to the market if the market is competitive : the oil price schok of 1980 sent gasoline prices sharply higher. Coal prices moved in sympathy with oil prices, with the result, that coal companiesearned pure economic profits. Since coal is homogenous good and the market is competitive , what ha..

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Express the angle with respect to the tangential velocity

Express the angle with respect to the tangential velocity vector (ie, +90° points radially out). (Points : 5) A) 10.9 m/s2 at -75° B) 10.9 m/s2 at +75° C) 37.9 m/s2 at -75° D) 37.9 m/s2 at +75°

  Recognize and explain six basic computer operations

Recognize the six basic computer operations. Describe each operation's role in computer program and indicate whether it is part of program's input component,

  Draw a flow chart, hierarchy chart

Draw a flow chart, hierarchy chart, and write pseudocode for the following problem. • A weather sensing system calculates & prints a report on the following: ? Average temperature ? Highest temperature ? Lowest temperature ?

  Variety of tools that use to prepare project

In this course, you looked at a variety of tools that you would use to prepare a project. Some areas you looked at included, but were not limited to?

  What are the benefits of using tangible interfaces

What are the benefits of using tangible interfaces compared with other interfaces like GUI, pen-based or gesture?

  Describe the major components of a datawarehouse

Briefly describe the major components of a datawarehouse architecture. Explain how the volatility of a datawarehouse is different from the volatility of a database for an operational information system. Please cite sources if any used.

  Write a one-page paper describing these new activities

Propose three to five additional activities you think should be added to a Gantt chart to help you estimate resources and durations. Write a one-page paper describing these new activities.

  What ''are the differences between a policy, a standard

What 'are the differences between a policy, a standard, and a practice? What are the three types of security policies? Where would each be used? What type of policy would be needed to guide use of the Web? E-mail? Office equipment for personal use?

  Display each of these amounts and the total

Display each of these amounts and the total. Use flowchart symbols for your answer.

  What to consider before selecting product for system

National Information Assurance Partnership website, why is this not enough to just say "this product meets our security requirements"? Discuss what else you have to consider before selecting such a product for a system.

  Compare and contrast twisted pair cable

Compare and contrast twisted pair cable, coaxial cable, fiber-optics, and wireless for this application. You should create a table or flow chart which would facilitate choosing between these options depending on circumstances.

  User can input an odd number in the range from 1 - 25

this pattern (9 rows), modify your program so that your user can input an odd number in the range from 1 - 25 for the number of rows in the diamond.

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