java - Calling substring Method? -


i new java. on past few weeks have been trying teach myself java. has been based on tutorials find online , forums can find. keep in mind , additional critique can share appreciated! trying create calculator runs off of if-else loops. i'm working on method allows user derive function based on principle if

f(x)=ax^n+bx^o+cx^p... f'(x)=anx^n-1+box^o-1+cpx^p-1... 

i'm trying use .split() separate parts of function, perform changes individual parts, , print them together. of way through couldn't convert string negative sign integer trying call method uses .substring , replaceall rid of negative sign convert integer. however, keep getting compiling error stating "actual , formal argument lists differ in length". can explain why might happening?

import java.util.scanner; import java.util.arrays; import java.lang.string; public class inputinteger { public string changesign(string second) {     string negative = second.substring(0,1);     return negative; } public static void splitfunction() {   scanner o = new scanner(system.in);   string function = o.next();   string[] parts = function.split("(?=\\+|\\-)");   (int = 0; < parts.length;) {          string[] second = parts[i].split("(?=[0-9]+|[a-z]+|[a-z]+\\^)");         inputinteger.changesign();         if (negative = ("-")) {             second = second.replace("-","");       int x = integer.parseint(second[0]);       int y = integer.parseint(second[2]);       int w = x*y;       int z = y-1;       system.out.println(w + "x^" + z);       i++;     }   } } 

problem talking method not working . have pass argument in function like

inputinteger.changesign(function); 

or

inputinteger.changesign(second[i]); 

according requirement


Comments

Popular posts from this blog

java - pagination of xlsx file to XSSFworkbook using apache POI -

Unlimited choices in BASH case statement -

apache - How do I stop my index.php being run twice for every user -