Advertisement
Guest User

Untitled

a guest
Jan 18th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. import javax.naming.OperationNotSupportedException;
  4.  
  5. public class Computer {
  6. Scanner sc = new Scanner(System.in);
  7. private int year;
  8. private double price;
  9. private boolean isNotebook;
  10. private double hardDiskMemory;
  11. private double freeMemory;
  12. String operationSystem;
  13.  
  14.  
  15.  
  16. public Computer(int year){
  17. this.year = year;
  18. }
  19. public Computer(int year, double price) {
  20. this(year);
  21. this.price = price;
  22. }
  23. public Computer(int year, double price, boolean isNotebook) {
  24. this(year, price);
  25. this.isNotebook = isNotebook;
  26. }
  27. public Computer(int year, double price, boolean isNotebook, double hardDiskMemory) {
  28. this(year, price, isNotebook);
  29. this.hardDiskMemory = hardDiskMemory;
  30. }
  31. public Computer(int year, double price, boolean isNotebook, double hardDiskMemory, double freeMemory) {
  32. this(year, price, isNotebook, hardDiskMemory);
  33. this.freeMemory = freeMemory;
  34. }
  35. public Computer(int year, double price, boolean isNotebook, double hardDiskMemory, double freeMemory, String operationSystem) {
  36. this(year, price, isNotebook, hardDiskMemory, freeMemory);
  37. this.operationSystem = operationSystem;
  38. }
  39.  
  40.  
  41. public void changeOperationSystem(String operationSystem) {
  42. this.operationSystem = operationSystem;
  43. }
  44.  
  45. public void useMemory(double memory) {
  46. if (memory > freeMemory) {
  47. System.out.println("Nqma dostatuchno svobodno mqsto!");
  48. }
  49. freeMemory -= memory;
  50. }
  51.  
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement