package Software.Task;

import java.util.Scanner;

import toolBox.Print;
import Hardware.Computer;

public class Info extends Task{
	
	public Scanner reader = new Scanner(System.in);

	public Info(Computer computer, String name, int minUsage, int space) {
		super(computer, name, "exe", minUsage, space, false);
	}
	
	public void start() {
		if(computer.getRam().getTotalRam() - computer.getRam().getUsedRAM() > minUsage && computer.on) {
			Print.info("Starting " + (computer.getOs().getName() + ".task.start.info.exe"));
			computer.getRam().addUsedRAM(minUsage);
			task();
		} else {
			if (computer.on) {
				Print.info("---------------------------------------------------");
				Print.info("Error when trying to start: " + (computer.getOs().getName() + ".task.start.info.exe"));
				Print.info("---------------------------------------------------");
				Print.info("ERROR Type:  NO_RAM_FOR_TASK");
				Print.info("ERROR Info:  Total  RAM: " + computer.getRam().getTotalRam());
				Print.info("             Used   RAM: " + computer.getRam().getUsedRAM());
				Print.info("             Needed RAM: " + minUsage);
				Print.info("---------------------------------------------------");
				Print.info("Error happendes when the computer doesn't have");
				Print.info("enoght RAM to run an task! Upgrade your RAM or");
				Print.info("stop unused tasks to avoid getting the error! ");
				Print.info("---------------------------------------------------");
			} else {
				Print.info("Coul'd not load task! Computer is not turned on!");
			}
		}
	}
	
	public void task() {
		Print.info("------------Computer info------------");
		Print.info("OS name: " + computer.getOs().getName());
		Print.info("-------------------------------------");
		Print.info("RAM name: " + computer.getRam().getName());
		Print.info("RAM total space: " + computer.getRam().getTotalRam() + "MB");
		Print.info("RAM used space: " + computer.getRam().getUsedRAM() + "MB");
		Print.info("-------------------------------------");
		Print.info("CPU name: " + computer.getCpu().getName());
		Print.info("CPU speed: " + computer.getCpu().getSpeed() + "MHz");
		Print.info("-------------------------------------");
		Print.info("HD name: " + computer.getHd().getName());
		Print.info("HD total space: " + computer.getHd().getTotalSpace() + "MB ( " + (computer.getHd().getTotalSpace() / 1024) + "GB )");
		Print.info("HD used space: " + computer.getHd().getUsedSpase() + "MB ( " + (computer.getHd().getUsedSpase() / 1024) + "GB )");
		Print.info("-------------------------------------");
		reader.next();
		stop();
	}
	
	public void stop() {
		Print.info("Starting " + (computer.getOs().getName() + ".task.kill.info.exe"));
		computer.getRam().addUsedRAM(-minUsage);
	}
	
}

@@ -66,16 +66,41 @@
 .Print;%0A
+import Error.ErrorTypes;%0A
 import H
@@ -367,42 +367,36 @@
 %09if(
-computer.getRam().getTotalRam() - 
+!ErrorTypes.NO_RAM_FOR_TASK(
 comp
@@ -412,23 +412,9 @@
 am()
-.getUsedRAM() %3E
+,
  min
@@ -418,16 +418,17 @@
 minUsage
+)
  && comp
@@ -445,1107 +445,171 @@
 %0A%09%09%09
-Print.info(%22Starting %22 + (computer.getOs().getName() + %22.task.start.info.exe%22));%0A%09%09%09computer.getRam().addUsedRAM(minUsage);%0A%09%09%09task();%0A%09%09%7D else %7B%0A%09%09%09if (computer.on) %7B%0A%09%09%09%09Print.info(%22---------------------------------------------------%22);%0A%09%09%09%09Print.info(%22Error when trying to start: %22 + (computer.getOs().getName() + %22.task.start.info.exe%22));%0A%09%09%09%09Print.info(%22---------------------------------------------------%22);%0A%09%09%09%09Print.info(%22ERROR Type:  NO_RAM_FOR_TASK%22);%0A%09%09%09%09Print.info(%22ERROR Info:  Total  RAM: %22 + computer.getRam().getTotalRam());%0A%09%09%09%09Print.info(%22             Used   RAM: %22 + computer.getRam().getUsedRAM());%0A%09%09%09%09Print.info(%22             Needed RAM: %22 + minUsage);%0A%09%09%09%09Print.info(%22---------------------------------------------------%22);%0A%09%09%09%09Print.info(%22Error happendes when the computer doesn't have%22);%0A%09%09%09%09Print.info(%22enoght RAM to run an task! Upgrade your RAM or%22);%0A%09%09%09%09Print.info(%22stop unused tasks to avoid getting the error! %22);%0A%09%09%09%09Print.info(%22---------------------------------------------------%22);%0A%09%09%09%7D else %7B%0A%09%09%09%09Print.info(%22Coul'd not load task! Computer is not turned on!%22);%0A%09%09%09%7D
+if(computer.ROOT) %7B%0A%09%09%09%09Print.info(%22Starting %22 + (computer.getOs().getName() + %22.task.start.info.exe%22));%0A%09%09%09%7D%0A%09%09%09computer.getRam().addUsedRAM(minUsage);%0A%09%09%09task();
 %0A%09%09%7D
@@ -1668,24 +1668,47 @@
 id stop() %7B%0A
+%09%09if(computer.ROOT) %7B%0A%09
 %09%09Print.info
@@ -1777,16 +1777,20 @@
 exe%22));%0A
+%09%09%7D%0A
 %09%09comput

Update Info.java