Reading of coefficients

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

Write a C++ program (without a use of global variables) to solve a single quadratic equation of the form:

a*x2 + b*x + c = 0

with the following specific requirements:

1) Reading of coefficients a, b, c shall be done by a function named readCoeffs(). They shall be entered

as double's from the keyboard by an operator, after prompt, as follows:

Enter coefficient a: <operator enters a>

Enter coefficient b: <operator enters b>

Enter coefficient c: <operator enters c>

<one empty line should follow this sequence of three prompts>

and returned to the caller as a structure with 3 fields.

2) The actual solution of the equation shall be done by a function named equSolver(), which takes three

coefficients as parameters and returns a structure of three fields: two roots (if they exist) and a boolean

indicator, whether the roots do exist.

3) The function equSolver() shall call another function named discr() to calculate and return the

discriminant necessary to compute the roots.

4) After equation is solved, another function named outResults() shall display on the screen results of the

calculation in the following format:

a) If the solutions (roots) exist in the real domain, the output shall look as follows:

Quadratic equation with the following coefficients:

a: <value>; b: <value>; c: <value>

has the following roots

Root1: <value>; Root2: <value>;

<one empty line should follow this sequence of lines>

b) In case there are no solutions (roots) in the real domain, the output shall look as follows:

Quadratic equation with the following coefficients:

a: <value>; b: <value>; c: <value>

has no roots in the real domain.

<one empty line should follow this sequence of lines>

5) All functions shall be placed in a file separate from main(), named funcs.cpp, and a makefile shall

be constructed and used for compilation.

? Form of submission: Two C++ source files named asisgn1.cpp (with main() program) and

funcs.cpp (with functions) should be placed in your account on sanibel in a directory named

assigns (created in your user directory); in addition, the makefile should also be placed there

Reference no: EM13168212

Questions Cloud

Properties in glass and soil examined for evidence : How are the properties in glass and soil examined for evidence? Why are glass and soil examined when present at a crime scene?
Physical property and chemical property : Define the terms “physical property” and “chemical property” as they pertain to crime scene investigations. What properties, physical or chemical, in glass and soil specimens from a crime scene are investigated? How are the properties in glass and so..
Directions for assignment : With today’s computers, the right to privacy is an especially challenging problem. Corporate privacy and the privacy of individuals is a major concern of the Federal Government.
Scope and lifetime are distinct : Scope and lifetime are distinct yet related issues in programming languages. Languages can sometimes make design decisions that cause a conflict between the scope and the lifetime of variables. Java's decision to allow classes to be defined inside..
Reading of coefficients : Reading of coefficients a, b, c shall be done by a function named readCoeffs(). They shall be entered as double's from the keyboard by an operator, after prompt, as follows.
Automobile customers are billed : Suppose automobile customers are billed at the rate of $35 per hour for labor. Also, costs for parts and supplies are subject to a 5% sales tax. Write a program to print out a simplified bill.
Movie should be represented : Each movie should be represented by an object of type Movie. The Movie class must provide two public fields: title and category. Both of these fields should be Strings. The class should also provide a
Write in c++. read an inputfile.txt : write in C++.  read an inputFile.txt which contains integers that are virutal addresses, and I am suppossed to translate that into physical addresses using a page table and a transition lookaside buffer
Create a quick wedding program in indesign : create a quick wedding program in Indesign. Are there any websites with templates for wedding programs for Indesign? I am using Indesign CC.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  User that will be asked to input the time

Write a code for the following C++ problem. We will have a user that will be asked to input the time of a train traveling in terms of minutes and this minutes is a non-negative integer.

  Write recursive boolean method to accept array and value

Write down the recursive boolean method named isMember. The method must accept two arguments: an array and a value. Method must return true if value is found in array.

  File system with login authentication

Implement a simple file system with login authentication and access control - Construct a hash/salt/shadow based user/password creation system.

  String converter

String Converter: Implement a program that asks the user to input up to 20 strings (stopping when the user inputs 0). Store these strings in a 2-dimensional array. Replace all the characters that are upper-cased to their lower-case equivalent.

  Write a function num_digits(n)

C programing, not C++ write a function num_digits(n) that returns the number of digits in a nonnegative integer n.

  The function should return a value

The function should return a value of 1 when it is given a valid score to process and 0 when the received value is out side of the 0-10 range. In this case it should print a waring message on the screen

  Create a structure that has one variable called value

"Create a structure that has one variable called value and one pointer to the list (making it a linked list). Prompt for 5 values from the keyboard as input and store them in the linked list. Print out the current contents of the list.

  Write program in c to calculate diameter-compression load

Write a program in C to calculate diameter in centimeters of steel rod, an aluminum rod, and a copper rod, which can withstand a particular compression load.

  Program which calculates the average and sum of the numbers

write down a program which calculates the average and sum of the numbers enter by a user.Using a While Loop

  In competitive tournament

In competitive tournaments, it is common for all the players or teams to play in a series of matches in order to determine a single winner of the entire tournament. However, a number of different tournament formats exist. Here, we will concern our..

  Create a file, shared.txt

When your program starts, it shall do the following:1. Create a file, SHARED.txt, in the current directory (cwd). 2. Write it's pid (Process ID) followed by a Carriage Return and Newline in the file.

  Submap that accepts two maps from strings

Write a method called subMap that accepts two maps from strings to strings as its parameters and returns true if every key in the first map is also contained in the second map and maps to the same

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