Last active
October 5, 2019 15:06
-
-
Save Peters8090/461c67752427f483b8cfd833bb1c184d to your computer and use it in GitHub Desktop.
[Computer programming homework] Java introduction: Write a program that simulates calculator operations. Create variables number1 and number 2. Create variables summing [dodawanie], subtraction [odejmowanie] etc. Assign the results of specific mathematical operations to variables summing [dodawanie], subtraction [odejmowanie], etc.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package programowanie_komputerowe; | |
public class SimpleCalculator { | |
//liczby na ktorych beda wykonywane dzialania | |
static double liczba1 = Math.random(); | |
static double liczba2 = Math.random(); | |
//wyniki dzialan na liczbach 1 i 2 | |
static double dodawanie = liczba1 + liczba2; | |
static double odejmowanie = liczba1 - liczba2; | |
static double mnozenie = liczba1 * liczba2; | |
static double dzielenie = liczba1 / liczba2; | |
public static void main(String[] args) { | |
//prezentacja wynikow | |
System.out.println( | |
"liczba1: " + liczba1 | |
+ "\nliczba2: " + liczba2 | |
+ "\ndodawanie: " + dodawanie | |
+ "\nodejmowanie: " + odejmowanie | |
+ "\nmnozenie: " + mnozenie | |
+ "\ndzielenie: " + dzielenie | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment