daslaller

Untitled

May 29th, 2012
25
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.47 KB | None | 0 0
  1. /*
  2.  * To change this template, choose Tools | Templates
  3.  * and open the template in the editor.
  4.  */
  5. package derivata;
  6.  
  7. import java.io.BufferedReader;
  8. import java.io.IOException;
  9. import java.io.InputStreamReader;
  10. import java.util.ArrayList;
  11.  
  12. /**
  13.  *
  14.  * @author Lars
  15.  */
  16. public class Derivata {
  17.  
  18.     static ArrayList<Double> x = new ArrayList<>();
  19.  
  20.     /**
  21.      * @param args the command line arguments
  22.      */
  23.     public static void main(String[] args) {
  24.         BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
  25.         String variable;
  26.         System.out.println("input of numers in char input must be set, exponents and variables count ass one so x^1 is two different");
  27.         int exp;
  28.         String nameOfFunction = "F" + "'" + "() = ";
  29.         //  read the username from the command-line; need to use try/catch with the
  30.         //  readLine() method
  31.         try {
  32.             System.out.println("enter first variable eg. x/y/a");
  33.             variable = br.readLine();
  34.             System.out.println("enter the exponent of the first variable if exponent doesnt exist, put 1 in");
  35.             exp = Integer.parseInt(br.readLine());
  36.             if (exp > 0) {
  37.                 exp += -1;
  38.             }
  39.             System.out.println(nameOfFunction + (exp + 1) + variable + "^" + exp);
  40.         } catch (IOException ioe) {
  41.             System.out.println("IO error trying to read your name!");
  42.             System.exit(1);
  43.         }
  44.  
  45.     }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment