Advertisement
Guest User

Untitled

a guest
Nov 21st, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. package lesson12;
  2.  
  3. public class OOP {
  4.  
  5. int chisl = 0;
  6. int znam = 0;
  7.  
  8.  
  9. OOP(int chisl, int znam){
  10. this.chisl = chisl;
  11. this.znam = znam;
  12. }
  13.  
  14. void getCeloeChislo(){
  15. System.out.println("Выделение целого числа: " + this.chisl / this.znam);
  16. }
  17.  
  18. void getDrobnoeChislo(){
  19. System.out.println("Выделение дробной части: " + this.chisl % this.znam);
  20. }
  21.  
  22. void getChislo(){
  23. System.out.println("Вывод дроби на печать: " + this.chisl + "/" + this.znam );
  24. }
  25.  
  26. void getResult(){
  27. double result = (double) this.chisl / (double) this.znam;
  28. System.out.println("Результат деления в виде десятичной дроби: " + result);
  29. }
  30.  
  31. void plus(int chisl, int znam){
  32. double sum = (double) this.chisl / (double) this.znam + (double) chisl / (double) znam;
  33. System.out.println(this.chisl + "/" + this.znam + " + " + chisl + "/" + znam + " = " + sum);
  34. }
  35.  
  36. void multiplication(int chisl, int znam){
  37. double multiplication = (double) this.chisl / (double) this.znam * (double) chisl/ (double) znam;
  38. System.out.println(this.chisl + "/" + this.znam + " * " + chisl + "/" + znam + " = " + multiplication);
  39. }
  40.  
  41. void Delenie(int chisl, int znam){
  42.  
  43. }
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement