Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package lesson12;
- public class OOP {
- int chisl = 0;
- int znam = 0;
- OOP(int chisl, int znam){
- this.chisl = chisl;
- this.znam = znam;
- }
- void getCeloeChislo(){
- System.out.println("Выделение целого числа: " + this.chisl / this.znam);
- }
- void getDrobnoeChislo(){
- System.out.println("Выделение дробной части: " + this.chisl % this.znam);
- }
- void getChislo(){
- System.out.println("Вывод дроби на печать: " + this.chisl + "/" + this.znam );
- }
- void getResult(){
- double result = (double) this.chisl / (double) this.znam;
- System.out.println("Результат деления в виде десятичной дроби: " + result);
- }
- void plus(int chisl, int znam){
- double sum = (double) this.chisl / (double) this.znam + (double) chisl / (double) znam;
- System.out.println(this.chisl + "/" + this.znam + " + " + chisl + "/" + znam + " = " + sum);
- }
- void multiplication(int chisl, int znam){
- double multiplication = (double) this.chisl / (double) this.znam * (double) chisl/ (double) znam;
- System.out.println(this.chisl + "/" + this.znam + " * " + chisl + "/" + znam + " = " + multiplication);
- }
- void Delenie(int chisl, int znam){
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement