Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- import javax.naming.OperationNotSupportedException;
- public class Computer {
- Scanner sc = new Scanner(System.in);
- private int year;
- private double price;
- private boolean isNotebook;
- private double hardDiskMemory;
- private double freeMemory;
- String operationSystem;
- public Computer(int year){
- this.year = year;
- }
- public Computer(int year, double price) {
- this(year);
- this.price = price;
- }
- public Computer(int year, double price, boolean isNotebook) {
- this(year, price);
- this.isNotebook = isNotebook;
- }
- public Computer(int year, double price, boolean isNotebook, double hardDiskMemory) {
- this(year, price, isNotebook);
- this.hardDiskMemory = hardDiskMemory;
- }
- public Computer(int year, double price, boolean isNotebook, double hardDiskMemory, double freeMemory) {
- this(year, price, isNotebook, hardDiskMemory);
- this.freeMemory = freeMemory;
- }
- public Computer(int year, double price, boolean isNotebook, double hardDiskMemory, double freeMemory, String operationSystem) {
- this(year, price, isNotebook, hardDiskMemory, freeMemory);
- this.operationSystem = operationSystem;
- }
- public void changeOperationSystem(String operationSystem) {
- this.operationSystem = operationSystem;
- }
- public void useMemory(double memory) {
- if (memory > freeMemory) {
- System.out.println("Nqma dostatuchno svobodno mqsto!");
- }
- freeMemory -= memory;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement