Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
- package derivata;
- import java.io.BufferedReader;
- import java.io.IOException;
- import java.io.InputStreamReader;
- import java.util.ArrayList;
- /**
- *
- * @author Lars
- */
- public class Derivata {
- static ArrayList<Double> x = new ArrayList<>();
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
- String variable;
- System.out.println("input of numers in char input must be set, exponents and variables count ass one so x^1 is two different");
- int exp;
- String nameOfFunction = "F" + "'" + "() = ";
- // read the username from the command-line; need to use try/catch with the
- // readLine() method
- try {
- System.out.println("enter first variable eg. x/y/a");
- variable = br.readLine();
- System.out.println("enter the exponent of the first variable if exponent doesnt exist, put 1 in");
- exp = Integer.parseInt(br.readLine());
- if (exp > 0) {
- exp += -1;
- }
- System.out.println(nameOfFunction + (exp + 1) + variable + "^" + exp);
- } catch (IOException ioe) {
- System.out.println("IO error trying to read your name!");
- System.exit(1);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment