Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Klasascanner extends IllegalArgumentException {
- public static double Dodawanie(double a,double b)
- {
- return a+b;
- }
- public static double Odejmowanie(double a,double b)
- {
- return a-b;
- }
- public static double Mnozenie(double a,double b)
- {
- return a*b;
- }
- public static double Dzielenie(double a,double b)
- {
- if (b==0)
- {
- throw new IllegalArgumentException("b=0,cannot divide");
- }
- return a/b;
- }
- public static void main(String[] args)
- {
- double a , b;
- Scanner sc = new Scanner(System.in);
- a=Double.parseDouble(sc.nextLine());
- b=Double.parseDouble(sc.nextLine());
- System.out.println("Wynik dodawania"+Dodawanie(a,b));
- System.out.println("Wynik odejmowania"+Odejmowanie(a,b));
- System.out.println("Wynik mnożenia"+Mnozenie(a,b));
- System.out.println("Wynik dzielenia"+Dzielenie(a,b));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement