OOP C++
HERE IS THE FIRST PART NEEDED :
#include
using namespace std;
// Create coefficient structure
struct coefficient{
double a, b, c;
};
// Create Equation class
class Equation{
private:
struct coefficient coeff;
public:
// Define constructor of Equation class
Equation(double a, double b, double c){
coeff.a = a;
coeff.b = b;
coeff.c = c;
}
// Define addEq function of Equation class
Equation addEq(Equation e){
struct coefficient cof;
cof.a = coeff.a + e.coeff.a;
cof.b = coeff.b + e.coeff.b;
cof.c = coeff.c + e.coeff.c;
Equation eq(cof.a, cof.b, cof.c);
return eq;
}
// Define printPoly function to print of Polynomial
void printPoly(){
cout << coeff.a << "x^2" << " + " << coeff.b << "x" << " + " << coeff.c << endl;
}
// Define isEqual functino to check if two equations are equal or not
bool isEqual(Equation e){
return coeff.a == e.coeff.a && coeff.b == e.coeff.b && coeff.c == e.coeff.c;
}
};
// main function
int main(int args, char *argv[]){
// Check for valid Command Line Arguments length
if(args == 7 ){
// Create First Equation
Equation eq1(atof(argv[1]), atof(argv[2]), atof(argv[3]));
// Create Second Equation
Equation eq2(atof(argv[4]), atof(argv[5]), atof(argv[6]));
// Add two equations
Equation res = eq1.addEq(eq2);
/*Print result*/
cout << "Polynomial: ";
eq1.printPoly();
cout << "added to: ";
eq2.printPoly();
cout << "results in: ";
res.printPoly();
cout << "Is two equations equal? " << eq1.isEqual(eq2) << endl;
}
else{
cout << "Error in reading inputs!\n";
}
return 0;
}

Answers

Answer 1

This program is an implementation of Object-Oriented Programming (OOP) in C++. It defines a coefficient structure to store three coefficients of a quadratic equation, and an Equation class that encapsulates the coefficient structure.

The Equation class has a constructor that initializes the coefficients, an addEq function that adds two equations, a printPoly function that prints the polynomial expression of the equation, and an isEqual function that checks if two equations are equal or not.

The main function takes six command-line arguments and creates two Equation objects with these coefficients. It then adds them using the addEq method and prints the resulting equation using the printPoly method. Finally, it checks if the two equations are equal using the isEqual method.

This program demonstrates how objects can be used to represent real-world entities and provides encapsulation to prevent direct manipulation of data members. Additionally, it shows how classes can declare member functions to operate on the object's data members, providing a modular way of programming.

Learn more about coefficient structure here:

https://brainly.com/question/31778205

#SPJ11


Related Questions

Imagine that you are a professional white hat hacker, testing a company’s system to make sure they are ready for attacks. What method of attack (or combination of attacks) would you use? How does your motivation for hacking impact the type of attack that you employ? Discuss how you might approach hacking and how the motivation for your hacking impacts the methods you would use.

Answers

Answer:

A white hat hacker, or ethical hacker, uses penetration testing techniques to test an organization's information technology

Explanation:

which of the following refers to how a player shapes what happens in their own personal game experience by making choices within the game

a. pseudostory
b. metagame
c. iudonarrative
d iambic pentameter

Answers

The term that refers to how a player shapes what happens in their own personal game experience by making choices within the game is the metagame.

What is metagaming? Metagaming refers to the knowledge, strategies, and actions used to control and dominate the environment of the game world. Metagaming is frequently employed by seasoned players to gain an advantage over newer or less experienced gamers, but it can also be utilized in cooperative multiplayer games to improve team strategy.  The term "metagame" refers to the act of playing the game beyond the game. This refers to the strategic thinking that happens outside of the game, such as studying the game rules, considering the game mechanics and design, and optimizing your gameplay.  Metagaming is typically seen in competitive video games, where players need to have a thorough understanding of the game's mechanics, strengths, and weaknesses to maximize their efficiency. In a first-person shooter game, for example, you might learn the maps and spawn points to get the advantage over other players. a real-time strategy game, the best players may use a specific set of tactics, such as rushing or turtling, to overwhelm their opponents and gain an advantage. Players also often use metagaming in MMORPGs to find the most effective methods for leveling up or acquiring gear and currency.In conclusion, Metagaming refers to the knowledge, strategies, and actions used to control and dominate the environment of the game world.

To Know more about multiplayer  visit:

https://brainly.com/question/30218631

#SPJ11

the where clause includes the conditions for row selection within a single table or view and the conditions between tables or views for joining. T/F

Answers

False. The statement is not entirely accurate. The WHERE clause in SQL is used to filter rows within a single table or view based on specified conditions. It is not responsible for conditions between tables or views for joining.

To specify conditions between tables or views for joining, the JOIN clause is used in SQL. The JOIN clause allows you to combine rows from multiple tables or views based on related columns using different types of joins (e.g., INNER JOIN, LEFT JOIN, etc.). The conditions for joining tables or views are typically specified in the ON clause within the JOIN statement.Therefore, the WHERE clause is used for filtering rows within a single table or view, while the JOIN clause handles conditions between tables or views for joining.

To learn more about specified  click on the link below:

brainly.com/question/30505881

#SPJ11

.A user is attempting to navigate to a website from inside the company network using a desktop. When the user types in the URL, https://www.site.com, the user is presented with a certificate mismatch warning from the browser. The user does not receive a warning when visiting http://www.anothersite.com. Which of the following describes this attack?
A. On-path
B. Domain hijacking
C. DNS poisoning
D. Evil twin

Answers

A user is attempting to navigate to a website from inside the company network using a desktop. This scenario describes the On-path attack. The certificate mismatch notice mentioned in the question has nothing to do with these attacks particularly. The correct option is A.

In an on-path attack, the hacker eavesdrops or intercepts the user's communication with the website. A different certificate than the one anticipated for the website can be displayed to the user as a result of the attacker altering the traffic. The browser may issue a certificate mismatch warning as a result of this.

Thus, the ideal selection is option A.

Learn more about the on-path attacks here:

https://brainly.com/question/32274173

#SPJ12

Answering the question here will not affect your activity score or grade.
Select the incorrect assumptions participants tend to make when solving this nine-dot problem, thus preventing them from reaching a solution.
☑ the lines must begin and end on dots
☑ each line should cancel out a full row or columns of dots

Answers

The incorrect assumption that participants tend to make when solving the nine-dot problem is "each line should cancel out a full row or columns of dots."

This assumption prevents them from reaching a solution because it restricts their thinking to the boundaries formed by the dots. In reality, the solution to the nine-dot problem requires extending the lines beyond the perceived boundaries of the dots, thinking outside the box. By assuming that the lines must cancel out full rows or columns, participants limit their possibilities and fail to recognize that the solution requires extending the lines outside the confines of the dot grid.

To learn more about  participants   click on the link below:

brainly.com/question/6670125

#SPJ11

Which of the below would provide information using data-collection technology?

Buying a new shirt on an e-commerce site
Visiting a local art museum
Attending your friend's baseball game
Taking photos for the school's yearbook

Answers

The following statement would provide the information by utilising data-collection technology: Buying a new shirt on an e-commerce site.

What is data collection?
The process of obtaining and analysing data on certain variables in an established system is known as data collection or data gathering. This procedure allows one to analyse outcomes and provide answers to pertinent queries. In all academic disciplines, including the physical and social sciences, the humanities, and business, data collecting is a necessary component of research. Although techniques differ depending on the profession, the importance of ensuring accurate and truthful collection does not change. All data gathering efforts should aim to gather high-caliber information that will enable analysis to result in the creation of arguments that are believable and convincing in response to the issues that have been addressed. When conducting a census, data collection and validation takes four processes, while sampling requires seven steps.

To learn more about data collection
https://brainly.com/question/25836560
#SPJ13

Which of these cannot be used to open a zip file?
O WinZip
O WordPad
File Viewer Plus
O Apple Archive Utility

Answers

Answer:

c

Explanation:

bc

you have developed a new computer operating system and are considering whether you should enter the market and compete with microsoft. microsoft has the option of offering their operating system for a high price or a low price. once microsoft selects a price, you will decide whether you want to enter the market or not enter the market. if microsoft charges a high price and you enter, microsoft will earn $30 million and you will earn $10 million. if microsoft charges a high price and you do not enter, microsoft will earn $60 million and you will earn $0. if microsoft charges a low price and you enter, microsoft will earn $20 million and you will lose $5 million. if microsoft charges a low price and you do not enter, microsoft will earn $50 million and you will earn $0. In a simultaneous move game, Microsoft will and you will:___________

Answers

In a simultaneous move game, Microsoft will and you will If Microsoft asks for a higher price, it could be $30 million or $60 million. If the company were to charge the lower price, it would be $20 million or $50 million. The best strategy is to charge a higher price.

What is price market?

Market price is the current price at which an asset or service can be bought or sold. The market price of an asset or service is determined by supply and demand. The market price is the price at which the quantity supplied equals the quantity demanded. Market prices depend on the interaction of supply and demand. Equilibrium price is the balance of demand and supply factors.

Learn more about market price: https://brainly.com/question/24877850

#SPJ4

how many key stages are there in our cognitive development

Answers

The cognitive development process is a complex one. The different stages of cognitive development are demarcated by distinctive changes in reasoning patterns, knowledge acquisition, and information processing capacity.

There are four different key stages in the cognitive development process, which are as follows:

During the sensorimotor stage, which takes place between birth and the age of two years, infants and toddlers develop sensory and motor abilities. At this stage, children's cognitive processes rely mostly on immediate sensory perceptions, actions, and reflexes. The preoperational stage of cognitive development occurs between the ages of two and seven years. In this stage, children become more proficient in their language and mental representation abilities. Children in this stage have an emerging ability to think symbolically, but their thinking is egocentric, lacking the ability to take into account other people’s perspective. The third stage of cognitive development is the concrete operational stage, which spans from seven to 11 years of age. In this stage, children become more capable of performing mental operations on objects, but only concrete, physical objects. Children in this stage are able to think logically and causally about concrete events but have difficulty thinking about abstract or hypothetical concepts.The fourth and final stage is the formal operational stage, which takes place at the age of 11 and beyond. During this stage, children begin to understand abstract concepts, hypothetical thinking, and formal logic. This stage involves a higher level of reasoning capacity and a capacity to think hypothetically and deductively.

Know more about the cognitive development

https://brainly.com/question/14472406

#SPJ11

What is the difference between a function with parameters, and a function
without parameters? *

Answers

Answer:

A function with out parameters cannot take any arguments or perform operations on variables passed in. A function with parameters can.

PLEASE HELP WITH MY COMPUTER
this thing is popped up and it's annoying. I'm on a HP laptop how do i get rid of it?​

PLEASE HELP WITH MY COMPUTERthis thing is popped up and it's annoying. I'm on a HP laptop how do i get

Answers

Answer:

Escape or turn it off then back on??

Explanation:

I'm not very sure what is going on but idfk

Please help!!!! 100 points!!

Please help!!!! 100 points!!

Answers

Answer:

I DONT GET IT

Explanation:

I was also looking for an answer for the same question lo

Why is the list constructor commonly used to find an index of an array element? Select an answer: .
a. index returns the array value for a particular index.
b. The array must be stripped of redundant information.
c. Arrays are not ordered. .
d. index only works with lists.

Answers

The list constructor is commonly used to find an index of an array element because it is a data structure that is an ordered sequence of items in Python programming.

This implies that the elements are arranged in a specific order and can be accessed using an index, and a list in Python is simply a collection of items that are separated by commas, with the whole list being surrounded by square brackets ([ ]).

Moreover, lists are mutable, which means that they can be modified after they have been created by adding, deleting, or modifying elements in the list.

In addition, the indexing of list elements begins at 0, which means that the first element in the list has an index of 0, the second has an index of 1, and so on. This makes it easy to find the index of a specific element in a list using the list constructor and the index() method, which returns the index of the first occurrence of the specified element in the list.If the element is not present in the list, it raises a ValueError. For instance, given a list

L = [10, 20, 30, 40, 50],

To know more about constructor visit:

https://brainly.com/question/13267120

#SPJ11

what is polling in python and what is active variable??

Answers

Answer:

Polling is a powerful python utility used to wait for a function to return a certain expected condition.An active variable is a variable that is manipulated by the investigator.

Explanation:

What is the difference between safety stock inventory and the cross docking method?

Answers

Answer:

Cycle stock inventory represents the quantity of inventory that a business can sell and replenish according to plan. It does not include safety stock which is held to maintain sales in times of sustained high demand. In comparison, safety stock is held to prevent stockouts that can become costly when they equate to lost sales and poor inventory management.

Hope this helps

Ưu nhược điểm của cuộn cảm

Answers

Answer:

yvhchfjfhvjvbjbhkhihihigivjbib

which tag preserves the spaces, tabs, and line breaks within a piece of text so a poem or piece of code can be presented faithfully?

Answers

The tag that preserves spaces, tabs, and line breaks within a piece of text to present a poem or piece of code faithfully is the "pre" tag.

The "pre" tag in HTML stands for "preformatted text" and is used to display text exactly as it appears in the HTML code, preserving spaces, tabs, and line breaks. This tag is commonly used when displaying poems, source code, or any other text where the exact formatting is essential.

When text is placed within the "pre" tags, the browser will render it with a monospaced font and maintain the original spacing and line breaks. This ensures that the poem or code is presented accurately and maintains its intended structure. Therefore, the "pre" tag is the correct option for preserving the formatting of spaces, tabs, and line breaks in text.

You can learn more about HTML at

https://brainly.com/question/4056554

#SPJ11

WILL GIVE BRAINLIEST
Which online note-taking tool allows students to place an image on one side and a description on the other?

web clipping tools

electronic notebooks

electronic flash cards

online data storage sites

Answers

Answer:

electronic flashcards I think

Rachel is planning on writing code that will have to do computations with very large
numbers. Which of the following is the most important issue she should check
before writing her code?
PLEASE

Answers

Group of answer choices.

A. Rachel should look up how many bits are used to store integers and floating point numbers in the programming language she is using.

B. Rachel should reset her machine to store data using hexadecimal values instead of binary.

C. Rachel should run a program to ensure that she has enough memory on her machine to write the program itself.

D. Rachel does not have to worry about the size of the numbers

Answer:

A. Rachel should look up how many bits are used to store integers and floating point numbers in the programming language she is using.

Explanation:

In Computer programming, a bit is a short word for the term binary digit and is primarily the basic (smallest) unit measurement of data or information.

A bit is a logical state which represents a single binary value of either one (1) or zero (0). This ultimately implies that, a single bit in computer science represents a boolean value of;

1. True or ON, which is equal to one (1).

2. False or OFF, which is equal to zero (0).

Additionally, a binary numbering represents all numeric values that are to be written in sequences of ones (1s) and zeroes (0s). Therefore, a binary number refers to any numerical value (number) that is expressed in base-2 numerical system; 0s and 1s.

Also, the total numbers which can be represented with an 8 bit binary (base-2) system is 256.

For all computations that would involve the use of very large numbers, it's important to look up how many bits are used to store integers and floating point numbers.

In this context, Rachel should ensure that she check how many bits the chosen high-level programming language uses to store integers and floating point numbers before writing her codes.

Although not an exact equivalent, the first column in a vlookup table_array serves a role that is similar to what database concept?.

Answers

It is most similar to a database primary key.

The first column in a vlookup table_array serves a role that is similar to the concept of A key

What is VLOOKUP?

This is known to be one of the most flexible way to get back data that is often use through the VLOOKUP function.

This is one that shows the value a person want to lookup in a tableThe term VLOOKUP searches for any kind of matching value in the leftmost column of the table, and then gets it back that is that same value in the same row.

Learn more about VLOOKUP  from

https://brainly.com/question/20566143

What is the next line? >>> myTuple = [10, 20, 50, 20, 20, 60] >>> myTuple.index(50) 1 2 4 3

Answers

Answer:

2

Explanation:

got right on edg.

Answer:

2

Explanation:

i got it wrong for the right answer

Choose the correct term to complete the sentence.

Professional communication must be objective,

, and unemotional
informal
technical
rational

Answers

Answer:

the answer to your question is obviously "rational"

The correct option is rational.

What is Professional communication?Professional communication is a metier subfield of communication that pays close concentration to the theories and methods of communication within professional contexts.After reading this direction, you will better comprehend the four main types of contact: Verbal, non-verbal, written, and visual. You will be able to use this knowledge to improve your transmission and make sure that you are encouraging effective communication skills within your organization. Proficient communication refers to the oral, written, visual, and digital forms of providing information in the context of a workplace. Practical professional communication is essential in today's world. Most situations in an institution arise as a result of poor communication.

To learn more about Professional communication, refer to:

https://brainly.com/question/26152499

#SPJ2

This question has two parts : 1. List two conditions required for price discrimination to take place. No need to explain, just list two conditions separtely. 2. How do income effect influence work hours when wage increases? Be specific and write your answer in one line or maximum two lines.

Answers

Keep in mind that rapid prototyping is a process that uses the original design to create a model of a part or a product. 3D printing is the common name for rapid prototyping.

Accounting's Business Entity Assumption is a business entity assumption. It is a term used to allude to proclaiming the detachment of each and every monetary record of the business from any of the monetary records of its proprietors or that of different organizations.

At the end of the day, we accept that the business has its own character which is unique in relation to that of the proprietor or different organizations.

Learn more about Accounting Principle on:

brainly.com/question/17095465

#SPJ4

what is the role of computer in education sector?​

Answers

Explanation:

Computer can improve the student learning and basic skill area. Computers not only improve the learning process, it also increases retention of the students. Effective and adequate teacher learning is an integral element of the successful learning program.


What type of pointing device is often used by artists, and why is it ideal for artists?​

Answers

Answer:

A drawing/graphics tablet

Explanation:

It is ideal for artists, due to it being very similar to as if you were to draw on paper. The stylus replicates a pencil or pen.

Which line of code outputs the decimal portion of a float stored in the
variable x?

Answers

Answer:

the answer is a

Explanation:

How many tens are there in the number 156?
A. 1
B. 15
C. 6
D. 56

Answers

Answer:

15

Explanation:

15 times 10 is 150, therefore there is 15 tens inside 156.

Answer:

15

Explanation:

Did you know, Death is the leading cause of Death?

There are many different risk factors that can drastically increase the likelihood of Death. Some risk factors can be: Jumping off cliffs, getting a heart attack, getting run over by a car, getting a stroke, and getting shot in the head.

Which of the following is the best reason for including a photograph in a formal business document

Answers

Answer:

The answer is "The reader wants to see how your product looks".

Explanation:

Some information is missing in the question. so, the correct choice can be described as follows:

The corporation uses records and reports to transfer facts, statistics, and figures, including explanations for enhancing activities, administration, and sales.  It generally refers to the various documentation, all with various sections and contents.  In the organization's usage of records for correspondence, transaction, and product research, that's why the "reader wants to see how your product looks" is the correct choice.

Answer:

Your Reader wants to see exactly what your product looks like

Explanation:

The reader will only think about purchasing if he can see what he's thinking of buying so he can be sure that he doesn't get ripped off.

Write an expression that prints "Special number" if specialNum is -99, 0, or 44. c++

Answers

Answer:

if (specialNum == -99 || specialNum == 0 || specialNum == 44) {

   std::cout << "Special number";

}

Explanation:

what is the minimum number of years over which computers may be depreciated under macrs?

Answers

Under MACRS (Modified Accelerated Cost Recovery System), the minimum number of years over which computers may be depreciated is five years.

MACRS is a tax depreciation system used in the United States for recovering the costs of tangible assets, including computers, used in a business or income-producing activity. It assigns specific recovery periods or classes to different types of assets. Computers fall under the "5-year property" class, which means they are depreciated over a period of five years. This means that businesses can claim annual depreciation deductions for computers over the course of five years, spreading out the cost of the asset over its useful life.

Learn more about MACRS here:

https://brainly.com/question/29220994

#SPJ11

Other Questions
Miguel buys a dozen (12) bagels for $9.99. How much money did he spend on each bagel? Give the iupac name for the following compound. be sure to answer all parts. ch3ch2con(ch3)ch2ch3 what might an organism do if there is a change to its ecosystem????? A: Move B: DieC: surviveD: All of theseI NEED HELP Consider this function: f(x) = (16x^3 + 27) (2x^2 + 13x + 15) Select ALL statements that are true about this function.a) 16x^3 + 27 is irreducible over the integersb) 2x^3 + 13x + 15 is irreducible over the integers c) 4x + 3 is a factord) x + 5 is a factor Which of the following represents a compound: A parent brings a 6-year-old to the clinic and informs the nurse that the child is tired all the time, even though the child sleeps 7 to 8 hours each night. what is the best response by the nurse? Explain how to find the measure of angles a and b has a measure of 36 degrees Find the measure of the angle indicated. PLSASE HELP !!!! pls help will mark brainliest QUESTION 1 In the diagram below, straight line PS is defined by 3y+2x=6 and cuts the x-axis at Q(3; 0). MQR is a straight line which meets PR at R(10; 4). N(6; -2) is a point on PS and RN is drawn. PR = 0. 1.1 17 M Gala O (3:0) Determine the gradient of PS. R(10:4) N(6-2) (2) How do the sources we get exposed to impact how we understand and remember history? Describe a time when you felt disrespected. Present the experience as if it is a scene from a novel. Describe the setting where the event took place. Explain who was there. Show what they did and said. Explain how you felt. Step 2: Describe the same experience a second time, but this time revise what people said and did in a way that would have left you feeling fully respected. In this revision of history, have everyone speak and behave in ways that would have changed the outcomes and experience for the better, leaving you feeling fully respected. Le participe pass4 Complte les phrases avec les verbes entre parenthses au pass compos.1. Ils ..... (finir) de manger? 2.Qui.....(telephoner)?3.Tu.....(voir)le film Le Fabuleux Destin d'Amelie Poulain? 4.Quel bus tu......(prendre) pour venir all death by lethal gases or in lethal injections interferes with the body's ability to use oxygen damaged skin cells are replaced through______. Mitosis, Meiosis Please explain the 12 table of Roman Law. I rly would appreciate the help rn. Thx 8. The amount of time a representative serves in congressA. SentenceB. SessionC. TermD. Special session 5 divided by 2 1/7 Simplest form Test: Vocabulary and Grammer 1.16 Answers A professional quarterback passed for 4,383 yards in 16 games in one football season. He wants to know his passing yardage per game, assuming he passed for the same number of yards each game.If he passed for the same number of yards each game, how many yards did he pass for in each game?plz help me.