Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package pl.dmcs;
- public class Main {
- public static void main(String[] args) {
- int a = 0;
- int b = 0;
- int c = 0;
- try {
- a = Integer.parseInt(args[0]);
- b = Integer.parseInt(args[1]);
- c = Integer.parseInt(args[2]);
- } catch (NumberFormatException nfe) {
- System.out.println("Argumenty programu powinny być liczbami! " + nfe);
- } catch (ArrayIndexOutOfBoundsException aioobe) {
- System.out.println("Liczba argumentów jest za mała!" + aioobe);
- }
- if (a == 0) {
- System.out.print("");
- } else {
- System.out.print(a + "x^2");
- }
- if (b == 0) {
- System.out.print("");
- } else if (b>0){
- System.out.print("+" +b + "x");
- } else {
- System.out.print(b + "x");
- }
- if (c == 0) {
- System.out.print("");
- } else if (c>0){
- System.out.print("+" +c);
- } else{
- System.out.print(+c);
- }
- System.out.println("=0");
- System.out.println("Przystępujemy do obliczenia pierwiastków: ");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement