Hello all. I would like to calculate, assign and do a lot with my program (java). Here are my codes.
import java.util.*;
public class Test
{
public static void main(String args[])
{
Scanner scan = new Scanner(System.in);
String[] s = new String[9];
int a;
for(a=0;a<9;a++)
{
s[a]=scan.next();
}
}
}
Here are my needs:
if the input is 1 2 3 4 5 6 =A1+A2 =A5+A3 =A5-A1
First i wd like to the program to recognize that the formulae start after the "=" sign, then allocate the string after the = sign to a position in the array(A1=s[0],A2=s[1] and so forfth), finally do the calulations and print the result as a matrix.(I know how to do all the rest but i'm stuck on these exceptional cases above). Thanks for help :=)
P.S.: There are spaces between the input.(1_2_3...).
Dr Windows (XP)
0
Light Poster
Recommended Answers
Jump to Postdepends on the complexity of what kind of equations you want to be able to supply to it.
just addition and subtraction won't be too difficult for you, but if you want it to have MDAS then it will be slightly more complex, and PEMDAS is even more compex... …
All 3 Replies
sciwizeh
62
Posting Pro in Training
Dr Windows (XP)
0
Light Poster
sciwizeh
62
Posting Pro in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.