7) Solving quadratic equation program Let's consider the general formula of a quadratic equation : ax? + bx +c = 0 Example in the equation : x? + 3x + 8 = 0 a=1, b=3 and c=8 where a, b and c are real numbers and a # 0 To solve the equation a discriminant D is calculated as: D = b2-4ac If D is less that 0: there is no solution If D is equal to 0: there is one solution b 2a If D is greater that 0: there is two solutions x1 and x2 -b + VD x1. 2a -b-VD x2 = 2a
Q: (Electrical eng.) The electrical resistance, r, of a metal wire, in ohms, is given by this formula:…
A: a. The resistance of the wire needs to be calculated. Hence, there will be only one output i.e., the…
Q: PROBLEM 2: Using user defined function and appropriate conditional and looping statements, create a…
A: The program is written in C++. Please find the source code in the below steps.
Q: Activity 20 Electric Bill: Using C Language and Using Switch Statement, Make a program that will…
A: Please find the code and output below:
Q: Complete the function yum to return the area of a pizza with a diameter of d inches. Assume the…
A: Step 1:- Note:-I am writing the program in c++ programming language because no programming language…
Q: Problem 2: This program will compute the volume of a cylinder. Write a function, area, that will…
A: As programming language is not mentioned we are providing answer in C++ language.…
Q: Problem #1: Car experts recommend changing your air filter as often as every 6000 miles if the oil's…
A: Declare two variables, char which stores category A or B and int which store miles in number.…
Q: C Program / CLanguage Make a C program. The date is january 1, 2019. Cody has a lot of neighbors who…
A: We have to follow this alogithm Declare two variables currentYear and birthYear Then ask the user…
Q: C++ program to find roots of a Quadratic Equation For a quadratic equation ax2+bx+c = 0 (where a, b…
A: Answer: Here is the code: #include <iostream>#include <cmath>using namespace std; int…
Q: 3- Enter a=3; b=5; e=7, then clear the variable b only Matlab
A: Step 1 : Start Step 2 : Take user input for the variable a , b and c using the input() function.…
Q: The function in the code snippet above is incomplete, and at least 4 more statements are required to…
A: The question is asking us to complete a linear search algorithm. So the completed code is mentioned…
Q: Problem Statement The area under a curve can be estimated by breaking the x axis into increments,…
A: Following is the Matlab code to find the area of the above function: clc; close all; %Taking all…
Q: ogramming problem Consider data points (xị, Y;), i = 0,..., n. We would like to interpolate them…
A: Newton's interpolation method.
Q: Rolling Two Dice (in c language) Write a program that simulates the rolling of two dice. The program…
A: A required program is as follows, #include<stdio.h> #include<time.h>…
Q: c++ program or code of Juan works on a field and for his work he receives 1/3 of the crop. If his…
A: #include<iostream>using namespace std; int main(){ float share_of_juan = 245; float part…
Q: In a triangle, the sum of the 1st and 2nd side must always be greater than the 3rd side. Create a…
A: Algorithm: for (initialExpression; testExpression; updateExpression){ // body of the…
Q: Based on the image attached, shows a statement of a program are in the incorrect order. Rearrange…
A: The Answer is
Q: Direction: Provide solution for Problem Solving Phase: d) Flowehart e.) Source Code in Ć Machine…
A: Algorithm: Take the distance, efficiency, and price of gas from user. Calculate the cost of commute…
Q: type python program with indentation for: Write a program to calculate the balance and minimum…
A: Actually, program is a executable software that runs on a computer.
Q: 1- Write C++ program (a Main function) that prints out whether a thrill-seeking person standing in…
A: Program Explanation:- Using the header file. Using the standard namespace input/output function.…
Q: Branching Statements on Solving Function My Solu Write a MATLAB program to evaluate the function…
A: According to the information given:- We have to follow the instruction mentioned.
Q: Assignment #1 Compute the net take-home pay of the employee in AXB Company. The program accepts name…
A: The program is written in c
Q: This exercise is to develop programming skills in comparative operations using the conditional…
A: Short Summary : Implemented the program as per requirementAttached source code and sample output
Q: Hypotenuse) Define a function hypotenuse that calculates the length of the hypotenuse of a right…
A: We can easily solve the problem . As the programming language is not mentioned in the question as…
Q: Complete the following program. An object floats in any fluid, if the density of the object is lower…
A: The program illustrates calculating density and printing the message based on the given constraint.…
Q: Problem #1: Car experts recommend changing your air filter as often as every 6000 miles if the oil's…
A: Actually, Java is a programming language originally developed by James Gosling at Sun Microsystems…
Q: Q3) (Temperature Conversions) Implement the following integer functions: a) Function celsius returns…
A: Programming is a way to instruct the computer devices to operate. Every computer needs a set of…
Q: C PROGRAM ONLY) 3. Outsmarting the Guard by CodeChum Admin Great! Thanks to your…
A: #include <stdio.h> int factorial(int n); int main(void) { int n; printf("Enter n: ");…
Q: MACHINE PROBLEM 2 Numerical Methods WRITE A COMPUTER PROGRAM USING ANY LANGUAGE OF YOUR CHOICE THAT…
A: Program: #include<iostream> #include<iomanip> #include<vector>…
Q: L- Example 1: Write a program that solves a quadratic equation using Quadratic equation (-b± Vb² –…
A: NOTE:“Since you have asked multiple questions, we will solve the first question for you. If you want…
Q: Q1- Example 1: Write a program that solves a quadratic equation using Quadratic equation (-b± vb² –…
A: Step 1:- Program Approach:- 1.Include header file 2.Declare variables 3.Take the input from the…
Q: (Temperature Conversions) Implement the following integer functions:a) Function toCelsius returns…
A: Since no programming language is mentioned, I am using c++. As per the given question, we need to…
Q: Problem #1: [35 pts] Profit calculation for an Avocado farm Write a program that helps a farmer…
A: .
Q: Provide your own short C++ code example that uses math operators of your choice. Try to use at least…
A: 100 + 10 is 110 as you can see in the output. We achieved this result of addition using the +…
Q: e of cube using constructor an
A: Code: #include<iostream>using namespace std; class cube{ public: double side; double…
Q: Modified coin-row problem: If we modified the coin-row problem, so that you cannot take the adjacent…
A:
Q: (c) Assuming function prototype is declared, identify and correct the errors for the following…
A: Here we are given a function definition. The function takes 2 integer parameters as input and…
Q: Q2) The following graph shows the x and y coordination of different cities. Write a C Program that…
A: Declare six integer variables to hold the x and y coordinates of the three points. Initialize the…
Q: ach occupied unit requires an average of $27 per month for maintenance. How many units should be…
A: The program of output in the number of units is given as,
Q: 4. A newly opened college ground is rectangular in shape and the Management decides to build a fence…
A: Algorithm: Step 1: Start Step 2: declare variables l and b Step 3: read l(length), b(width) Step 4:…
Q: 10. Salary/Income Calculator Write a C program that computes an employee's monthly salary and…
A: C is a versatile middle-level programming language that can be used for a variety of tasks. It can…
Q: Exercise 1: A large chemical company pays its sales staff on a commission basis. They receive 200…
A: //Importing library#include <stdio.h>//Importing library#include <stdbool.h>//Main of…
Q: NB: USE IF ELSE STATEMENTS FOR THIS CODING IN C++ • Calculate each student's grade - 10 students in…
A: Using object oriented approach. We have used if to determine whether the marks entered by user are…
Q: I need help with my program. When I run the program I input the yearly income and it skips to "Enter…
A: The program is correct there is only one problem data type. Data type means int, double, string,…
Q: In C++ A carpet company has determined that every 50 square feet of floor coverage will require 6…
A: #include<iostream>using namespace std; bool inputValidate(double);void getInfo(double&,…
Q: 4. A newly opened college ground is rectangular in shape and the Management decides to build a fence…
A: Algorithm: Step 1: Start Step 2: declare variables l and b Step 3: read l(length), b(width) Step 4:…
Q: Perform any two arithmetic operations on 'n' polynomials using the following options Structures in C…
A: Perform any two arithmetic operations on 'n' polynomials using the following options Structures in C…
Q: 4. A newly opened college ground is rectangular in shape and the Management decides to build a fence…
A: Algorithm: Step 1: Start Step 2: declare variables l and b Step 3: read l(length), b(width) Step 4:…
Q: Question 1 : (Solve quadratic equations) The two roots of a quadratic equation ax² + bx + c = 0 can…
A: Algortihm: 1.import java.util.Scanner 2.create a class called main 3.create a main method 4.check…
Step by step
Solved in 4 steps with 3 images
- Matlab A rocket is launched vertically and at t-0, the rocket's engine shuts down. At that time, the rocket has reached an altitude of ho- 500 m and is rising at a velocity of t125 m/s. Gravity then takes over. The height of the rocket as a function of time is: h(t)- ho+vot-gt², t20 where g = 9.81 m/s². The time t=0 marks the time the engine shuts off. After this time, the rocket continues to rise and reaches a maximum height of himax meters at time t-tmax. Then, it begins to drop and reaches the ground at time t = tg. a. Create a vector for times from 0 to 30 seconds using an increment of 2 s. b. Use a for loop to compute h(t) for the time vector created in Part (a). e. Create a plot of the height versus time for the vectors defined in Part (a) and (b). Mark the z and y axes of the plot using appropriate labels. d. Noting that the rocket reaches a maximum height, Amax, when the height function, h(t), attains a maxima, compute the time at which this occurs, tmax, and the maximum…Branching Statements on Solving Function My Soluti Write a MATLAB program to evaluate the function y(x) = Inx for any user-specified value of x, where x is a number. 1.0 (note that In is the natural logarithm, the logarithm to the base e). Use an if structure to verify that the value passed to the program is legal. If the value of x is legal, calculate y(x). If not, write a suitable error message and quit. Script e A Save C Reset E MATLAB Documenta 1 % Define variables: 2 % x -- First independent variable 3 % fun -- Resulting function 4 % Simulate: Prompt the user for the value x 5 disp('Enter x: '); 6 rndNum = randi([1,3]); 7 sampleNum = [-1 0 2]; 8 x = sampleNum(1,rndNum) 9 % Calculate the function use disp in showing your answer 10 11Programming Language :- C 7. A function is defined for a positive integer n as follows: 3n + 1, if n is odd f(n) = { n if n is even 2 We consider the repeated application of the function starting with a given integer n, as follows: f(n), f(f(n)), f(f(f(n))), It is conjectured that no matter which positive integer n you start from; this sequence eventually will reach to 1. If n = 13, the sequence will be 13, 40, 20, 10, 5, 16, 8, 4, 2, 1. Thus if you start from n = 13, you need to apply function 10 times to reach 1. Write a recursive function that takes n as an input number and returns how many times function f has to be applied repeatedly to reach 1.
- Function Composition Functions f(x) = 4 + x and g(x) = x5 - 3x. Evaluate (f. g)(-1) O 234 O -1 6 09Integer Linear Programming Exercise Please solve the following real-world problem: A businesswoman can travel to city A, city B, or city C. It is 122 miles to city A, 237 miles to city B, and 307 miles to city C. She can travel up to 3000 miles. Dining and other expenses are $95 in city A, $130 in city B, and $180 in city C. Her expense account allows her to spend $2000. A trip to city A will generate $800 in sales, while a trip to city B will generate $1300 and a trip to city C will generate $1800. How many trips should she make to each city to maximize sales? First, define variables x1, x2, x3, etc. Next, write equations and inequalities that show the constraints. Then, write the objective function. Please note that solving the problem requires integer linear programming because all variables have additional constraints of being integers, not real numbers. This is an NP-hard problem that cannot be solved by regular linear programming algorithms implemented in SciPy. You can solve the…Matlab A rocket is launched vertically and at t-0, the rocket's engine shuts down. At that time, the rocket has reached an altitude of ho- 500 m and is rising at a velocity of to 125 m/s. Gravity then takes over. The height of the rocket as a function of time is: h(t)-ho+vot-gt², t20 where g -9.81 m/s². The time t-0 marks the time the engine shuts off. After this time, the rocket continues to rise and reaches a maximum height of Amax meters at time t = tmax. Then, it begins to drop and reaches the ground at time t = tg. a. Create a vector for times from 0 to 30 seconds using an increment of 2 s. b. Use a for loop to compute h(t) for the time vector created in Part (a). e. Create a plot of the height versus time for the vectors defined in Part (a) and (b). Mark the and y axes of the plot using appropriate labels. d. Noting that the rocket reaches a maximum height, max, when the height function, h(t), attains a maxima, compute the time at which this occurs, max, and the maximum height,…
- Graph plottingwrite a code (can be in c ++, python, c # ...) that graphically represents the function f (w, t) = Eo cos (wt + δ) for the case below1)Eo=1 , w=1, δ=0 for t=0 to t=4π 2) Eo=5 , w=1, δ=0 for t=0 to t=4πThe ABC Lumber Co. asks you to write a Phyton program that would produce a table of g properties of its rectangular cross- section lumber. The dimension of the wood is given as base and height in inches. The table is to include the following information:Note: I want to solving this problem using C programming, No way to accepting C++. Please solve this problem with C programming. Question: Chocolate Thief Problem I gave some chocolates to students for their extraordinary performances. A chocolate is a cube shaped thing, which has length, width and height. All the students got the same amount of chocolates; their dimensions may be different but the volumes are the same. Now some of the students are claiming that there is one chocolate thief among them. So, it's not an easy task for me to find the chocolate thief, so I am asking your help. You are given the names of the students and the dimensions of their chocolates; you have to find the name of the chocolate thief. You can assume that there can be at most one thief and if there is a thief, he took some portion of the chocolate from exactly another student (not students). Input Input starts with an integer T (≤ 100), denoting the number of test cases. Each case starts with a line…
- When you borrow money to buy a house, a car, or for some other purpose, you repay the loan by making periodic payments over a certain period of time. Of course, the lending company will charge interest on the loan. Every periodic payment consists of the interest on the loan and the payment toward the principal amount. To be specific, suppose that you borrow $1,000 at an interest rate of 7.2% per year and the payments are monthly. Suppose that your monthly payment is $25. Now, the interest is 7.2% per year and the payments are monthly, so the interest rate per month is 7.2/12 = 0.6%. The first months interest on $1,000 is 1000 0.006 = 6. Because the payment is $25 and the interest for the first month is $6, the payment toward the principal amount is 25 6 = 19. This means after making the first payment, the loan amount is 1,000 19 = 981. For the second payment, the interest is calculated on $981. So the interest for the second month is 981 0.006 = 5.886, that is, approximately $5.89. This implies that the payment toward the principal is 25 5.89 = 19.11 and the remaining balance after the second payment is 981 19.11 = 961.89. This process is repeated until the loan is paid. Write a program that accepts as input the loan amount, the interest rate per year, and the monthly payment. (Enter the interest rate as a percentage. For example, if the interest rate is 7.2% per year, then enter 7.2.) The program then outputs the number of months it would take to repay the loan. (Note that if the monthly payment is less than the first months interest, then after each payment, the loan amount will increase. In this case, the program must warn the borrower that the monthly payment is too low, and with this monthly payment, the loan amount could not be repaid.)(Numerical) Heron’s formula for the area, A, of a triangle with sides of length a, b, and c is A=s(sa)(sb)(sc) where s=(a+b+c)2 Write, test, and execute a function that accepts the values of a, b, and c as parameters from a calling function, and then calculates the values of sand[s(sa)(sb)(sc)]. If this quantity is positive, the function calculates A. If the quantity is negative, a, b, and c do not form a triangle, and the function should set A=1. The value of A should be returned by the function.(Numerical) Write a program that tests the effectiveness of the rand() library function. Start by initializing 10 counters to 0, and then generate a large number of pseudorandom integers between 0 and 9. Each time a 0 occurs, increment the variable you have designated as the zero counter; when a 1 occurs, increment the counter variable that’s keeping count of the 1s that occur; and so on. Finally, display the number of 0s, 1s, 2s, and so on that occurred and the percentage of the time they occurred.