Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //sout - System.out.println("");
- import java.util.Scanner;
- public class Main {
- public static void main(String[] args) throws Exception {
- boolean zainstalowanySystem = false;
- boolean wlaczonyKomputer = false;
- System.out.println("-----------------------------");
- System.out.println("Symulator włączania komputera");
- System.out.println("-----------------------------");
- System.out.println("[1] Włączanie komputera");
- System.out.println("[2] Wyjście z programu");
- int opcja1 = System.in.read();
- System.out.println("Włączanie komputera...");
- Thread.sleep(3000);
- do
- {
- if (opcja1 == '1') {
- wlaczonyKomputer = true;
- System.out.println("[1] Załaduj system");
- System.out.println("[2] Sprawdź podzespoły");
- System.out.println("[3] Zainstaluj system");
- System.out.println("[4] Wyłącz komputer");
- int opcja2 = 0 ;
- Scanner odczyt = new Scanner(System.in);
- opcja2 = odczyt.nextInt();
- System.out.println(opcja2);
- clearScreen();
- if (opcja2 == 1 ) {
- if (zainstalowanySystem == true){
- System.out.println("Ładowanie systemu...");
- Thread.sleep(3000);
- System.out.println("Witamy w systemie!");
- }
- else {
- System.out.println("System nie został zainstalowany.");
- }
- }
- else if (opcja2 == 2) {
- System.out.println("Karta graficzna: off (-)");
- System.out.println("Dysk twardy: on (1TB)");
- System.out.println("Pamięć ram: on (8Gb)");
- odliczanie();
- }
- else if (opcja2 == 3) {
- System.out.println("Instalacja systemu...");
- Thread.sleep(3000);
- zainstalowanySystem = true;
- System.out.println("System został poprawnie zainstalowany.");
- odliczanie();
- }
- else if (opcja2 == 4){
- System.out.println("Wyłączanie komputera...");
- Thread.sleep(3000);
- wlaczonyKomputer = false;
- }
- else {
- System.out.println("Wybrałeś złą opcje");
- }
- }
- else if (opcja1 == '2') {
- System.out.println("Wyłączanie programu...");
- Thread.sleep(3000);
- System.exit(System.in.read());
- break;
- }
- else {
- System.out.println("Wybrałeś złą opcje");
- break;
- }
- } while(wlaczonyKomputer == true);
- }
- public static void odliczanie() {
- try
- {
- System.out.println("Powrót za: ");
- System.out.println("3");
- Thread.sleep(1000);
- System.out.println("2");
- Thread.sleep(1000);
- System.out.println("1");
- Thread.sleep(1000);
- }
- catch(InterruptedException e)
- {
- // this part is executed when an exception (in this example InterruptedException) occurs
- }
- }
- public static void clearScreen() {
- try
- {
- final String os = System.getProperty("os.name");
- if (os.contains("Windows"))
- {
- Runtime.getRuntime().exec("cls");
- }
- else
- {
- Runtime.getRuntime().exec("clear");
- }
- }
- catch (final Exception e)
- {
- // Handle any exceptions.
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement