Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package javaapplication12;
- import java.util.InputMismatchException;
- import java.util.Scanner;
- /**
- *
- * @author student
- */
- public class Kalkulator {
- public static void main(String[] args) {
- Scanner skaner = new Scanner(System.in);
- System.out.println("-== Kalkulator ==-");
- System.out.println("Dzielenie");
- System.out.print("Dzielna: ");
- double a = 0;
- try {
- a = skaner.nextDouble();
- } catch(InputMismatchException ex) {
- System.out.println("BLAD: Niepoprawne dane wejsciowe: " + ex);
- return;
- //ex.printStackTrace();
- }
- System.out.print("Dzielnik: ");
- double b = 0;
- try {
- b = skaner.nextDouble();
- } catch(InputMismatchException ex) {
- System.out.println("BLAD: Niepoprawne dane wejsciowe: " + ex);
- return;
- }
- double c = a/b;
- System.out.println("Iloraz: " + c);
- }
- }
Add Comment
Please, Sign In to add comment