ProrabVasili / java_labs_km14_pazyuka

0 stars 0 forks source link

Programm bags #1

Open ShkarupyloMaksym opened 2 years ago

ShkarupyloMaksym commented 2 years ago

I have the cod with test, so your sollution doesn`t pass them: public static void main(String[] args) throws StringCalculator.MyException { System.out.println(new StringCalculator().add("//[][%]\n12%3")); System.out.println(new StringCalculator().add("//[][]\n123")); try { System.out.println(new StringCalculator().add("1000,-999,-1001")); } catch (Exception e){ System.out.println(e.getMessage()); }

    try {
        System.out.println(new StringCalculator().add("1000,999,"));
    }
    catch (Exception e){
        System.out.println(e.getMessage());
    }
}

The right sollution is: 6 6 Error Error But your is: 0 0 Error 1999

ShkarupyloMaksym commented 2 years ago

So you should check your code)

ShkarupyloMaksym commented 2 years ago
    public static void main(String[] args) throws StringCalculator.MyException {
        System.out.println(new StringCalculator().add("//[*][%]\n1*2%3"));
        System.out.println(new StringCalculator().add("//[**][***]\n1**2***3"));
        try {
            System.out.println(new StringCalculator().add("1000,-999,-1001"));
        }
        catch (Exception e){
            System.out.println(e.getMessage());
        }

        try {
            System.out.println(new StringCalculator().add("1000,999,"));
        }
        catch (Exception e){
            System.out.println(e.getMessage());
        }
    }