Facebook
From Denim Treeshrew, 6 Years ago, written in Java.
Embed
Download Paste or View Raw
Hits: 270
  1. /*
  2.  * To change this license header, choose License Headers in Project Properties.
  3.  * To change this template file, choose Tools | Templates
  4.  * and open the template in the editor.
  5.  */
  6. package zadanie1;
  7.  
  8. import java.util.Scanner;
  9. /**
  10.  *
  11.  * @author Adam6560b
  12.  */
  13. public class Zadanie1 {
  14.  
  15.     /**
  16.      * @param args the command line arguments
  17.      */
  18.     public static void main(String[] args) {
  19.         // TODO code application logic here
  20.          double a,b,c;
  21.         double[] t = new double[10];
  22.         //String napis;
  23.         c=0;
  24.         String czypowt="T";
  25. do{
  26.     try{
  27.         // TODO code application logic here
  28.         Scanner in = new Scanner(System.in);
  29.         new Kalkulator();
  30.         System.out.print("dawaj liczbe 1: ");
  31.         a= in.nextDouble();
  32.         System.out.print("dawaj liczbe 2: ");
  33.         b= in.nextDouble();
  34.  
  35.         System.out.print("wynik..........." );
  36.         System.out.println(Kalkulator.dodawanie(a,b,c));
  37.        
  38.        
  39.        
  40.         System.out.print("T- powtórz obliczenia");
  41.          
  42.         czypowt= in.next();
  43.        
  44.     }catch (Exception ex){
  45.         System.out.println("zle dane!!!11!");
  46.         }
  47.     }while(czypowt.equals("T"));
  48.  
  49.     }
  50.    
  51. }
  52.  
  53.  class Kalkulator
  54.     {
  55.         //public Kalkulator(double a, double b)
  56.        
  57.             static double dodawanie(double a, double b,double c)
  58.             {
  59.             c=a+b;
  60.              return c;
  61.             }
  62.    
  63.        
  64.     }