Alright so I'm coding a Quadratic Equation Solver to help with my Math Class. However the teacher requires each calculation to be written out. I have the solver working, however I'm not sure where to start when it comes to printing each step. I know I will need to `System.out.println()` each step. But how does Java interpret the equation? Does it do proper BEDMAS(Brackets, Exponents, Division, Multiplication, Addition, Subtraction)? if(disc == 0) { x1 = (-b+Math.sqrt(Math.pow(b, 2)-4*a*c))/(2*a); System.out.println("One Root Found: " + x1); } else if(disc > 0) { x1 = (-b+Math.sqrt(Math.pow(b, 2)-4*a*c))/(2*a); x2 = (-b-Math.sqrt(Math.pow(b, 2)-4*a*c))/(2*a); //Output Results System.out.println("Two … |
+0 forum
3 | ||

I won't be asking for a source code yet. What I need to figure out is the process of a certain Math problem with the equation that seemed to be impossible to be converted to source code. Here it goes: **A certain waveform is 0 volts for time less than 2 seconds and 3 volts for time equal to or greater than 2 seconds. (These waveforms are referred to as step functions.) *Prompt the user accepts time in the variable named time and displays the appropriate voltage, depending on the input value.*** So the problem is asking for a program … |
+0 forum
9 | ||

Hello...just started learning C and i'm trying to write a program that solves quadratic equations...but every time i compile and run it and enter the 3 variables it crashes. I kept on looking but didn't find anything wrong with it...help? :P [CODE]#include <stdio.h> main(){ int a,b,c; float x1,x2; printf("Please enter a b c: \n"); scanf("%d %d %d",a,b,c); if (a == 1){ x1= (b/2) + sqrt(pow(b/2,2)-c); x2= (b/2) - sqrt(pow(b/2,2)-c); } else { x1= (b+ sqrt(pow(b,2) - 4*a*c))/(2*a); x2= (b- sqrt(pow(b,2) - 4*a*c))/(2*a); } printf("The solutions are: \n%f ja %f",x1,x2); getch(); }[/CODE] |
+0 forum
3 | ||

MY problem is related to entry of research data. The researchformula is entered into a textbox alongwith other usual form entries like title,subject,startdate etc. The formula consists of alzebra, trignometric, otherfunctions etc. Example [CODE] [B]x = 12; y = 24 + tit[x] + mixer[x]; z = x + sin(x) + tan(x+y) - max[x,y]; #final result is 24.778273666352;[/B][/CODE] The program is not concerned with the syntax or result of these formulas. The form must however display some details of the formula in the following format in textbox on buttonclick a) variableused name and characterlocation of variables like x(1,19) y(8,) since x … |
+0 forum
9 | ||

hi, I am trying to make a variable equation solver using DEV-C++. I just need to know how to get C++ to solve an equation inputed by the user. So you input something like 1+1 and i need it to solve the problem and output the answer. heres an example: [CODE]#include<iostream> using namespace std; int main (char argc) { string n1; cin >> n1; // i input 1+1 int n2; solve n1 = n2; cout << n2 << endl; // it outputs 2 }[/CODE] thanks |
+0 forum
75 | ||

Hey, everybody, I'm a newbie at Python (2.7.1), and new to DaniWeb as well. and the apparent simplicity of Python got me interested in programming (seriously, the only thing before this was HTML). Anyway... I was taking a test and thought that after I was finished I could make an equation calculator. I've got a few simple equations slapped on there, for proof-of-concept, and they work fine. However, I would like to go back to the user input line of code. How do I go about doing this? I've Googled it, and there's no "goto" function like there is in … |
+0 forum
30 |

The End.