From 16fc065973ed09cfe2388c58017b5559e85849f2 Mon Sep 17 00:00:00 2001 From: Kilokem Date: Fri, 13 Sep 2024 09:49:48 +0200 Subject: [PATCH] AnotherModulePassed --- .../src/main/java/com/example/BasicII.java | 26 ++++++++++++++++++ .../target/classes/com/example/BasicII.class | Bin 1714 -> 2166 bytes 2 files changed, 26 insertions(+) diff --git a/Basics_II/src/main/java/com/example/BasicII.java b/Basics_II/src/main/java/com/example/BasicII.java index 1656b28..2e9b4b5 100644 --- a/Basics_II/src/main/java/com/example/BasicII.java +++ b/Basics_II/src/main/java/com/example/BasicII.java @@ -45,5 +45,31 @@ public class BasicII { //Multidimensional arrays (row, col) int[ ][ ] sample = { {1, 2, 3}, {4, 5, 6} }; System.out.println(sample[0][2]); + + /* + You are creating a ticketing program for a small movie theater. + The seats are represented using a 2-dimensional array. + Each item can have the values 1 and 0 - 1 is occupied, and 0 if it's free. + Your program needs to take as input the row and the column of the seat and output Free if it's free, and Sold if it's not. + */ + int[][] seats = { + {0, 0, 0, 1, 1, 1, 0, 0, 1, 1}, + {1, 1, 0, 1, 0, 1, 1, 0, 0, 0}, + {1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, + {0, 0, 0, 1, 1, 1, 1, 0, 0, 0}, + {0, 1, 1, 1, 0, 0, 0, 1, 1, 1} + }; + System.out.print("The row you want: "); + int row = sc.nextInt(); + System.out.print("The column you want: "); + int col = sc.nextInt(); + + if (seats[row][col] > 0) { + System.out.println("Sold"); + }else{ + System.out.println("Free"); + } + + } } \ No newline at end of file diff --git a/Basics_II/target/classes/com/example/BasicII.class b/Basics_II/target/classes/com/example/BasicII.class index a13875efca74f97b9b4c8be10e2595a8ad13ba12..2bfbf0973df45cad6f01bb024afe3bbf6171bafc 100644 GIT binary patch delta 735 zcmZXR%}-N76vclt@3r&#`r%6xR5scb3l$bFpi&VGiisZ~u|(4Z(SBKw(iYl^h}y&$ zH^xxu08}YtI(PA?9=G-}F&b>3U72WaN?Vs;H0u!`4 zu47$rxT%QGEfy1N)%Cs5YPsN06g0C|EVkp; zv*Uq!G25ssEU}U-2NltDBb#5olC8~UbLFC;WT+XM?T)qTT3<25Kwo})!p^If^MUz{ z<+<!pxAo6guh(vnSE!WZ>80qIPjj|=?f_e^}T=U4yO1^arn{(6}n z;rICCv+wA*yM-5D=#m_?yQD_LetB!Jj10O1;gbWAk(b1LCfDWg8+xLGz>a)?g)8|5 zLz06yglNAGTy2f1C6ekXr_?LP)hANw8>e-YF@1nD`Vf=)2vd59vwE0mo#dRJ;=G<_ zMqlD0VKI9`)PGWLQ<5sGCt2hMicx)#B|(~!`obMyE$Zqs%apNsthQO9(jvf)x<-|n zO!Y&hS!E5QV)9dUK_PXW?=)xvJwXvRq1z%gd-!|guUA=FL$%ye%2lI934l$T8>9P zdce^DQ@lRLxd{_3TD)?b)oPj?-EFWWcKX*dg}NQFU=BE;g<;dIlL