HTW Berlin Medieninformatik

HTW Berlin
Fachbereich 4
Internationaler Bachelor Studiengang
Internationale Medieninformatik (Bachelor)
Info 2: Informatik II
Summer Term 2023


Exercise 5: Programming in the small

This week you will be working alone and practicing programming in the small.


Lab exercises

We are using Nick Parlante's Coding Bat for the first set of exercises. Please document which ones you did and record any problems you encountered solving the.

  1. Choose three exercises from the simple logic puzzles. Record the resulting code in your report.
  2. Choose two exercises from the medium logic puzzles. Record the resulting code in your report.
  3. Choose two exercises from the medium array puzzles. Record the resulting code in your report.
  4. Chose one exercise from the harder array puzzles. Record the resulting code in your report.

    Since you were doing lots of flags in GDM, here's another flag problem.

  5. Assume that you are a member of the programming committee for implementing a method to print the new EU flag after the Ukraine joins. The surprising decision is given below:

                      1         2         3         4 
             1---5----0----5----0----5----0----5----0 
             ???????????????????????????????????????? 
             ???????????????????????????????????????? 
             ??/= /= /= /= /=|  (    (    (    (  +?? 
             ??= /= /= /= /= |  (    (    (    ( + ?? 
             ?? /= /= /= /= /|  (    (    (    (+  ??  -5 
             ??/= /= /= /= /=|  (    (    (    +)))?? 
             ??= /= /= /= /= |  (    (    (   +    ?? 
             ?? /= /= /= /= /|  (    (    (  +     ?? 
             ??/= /= /= /= /=|  (    (    ( +))))))?? 
             ??= /= /= /= /= |  (    (    (+       ??  -10 
             ?? /= /= /= /= /|  (    (    +        ?? 
             ??/= /= /= /= /=|  (    (   +)))))))))?? 
             ??= /= /= /= /= |  (    (  +          ?? 
             ?? /= /= /= /= /|  (    ( +           ?? 
             ??/= /= /= /= /=|  (    (+))))))))))))??  -15 
             ??= /= /= /= /= |  (    +             ?? 
             ??---------------  (   +              ?? 
             ??  (    (    (    (  +)))))))))))))))?? 
             ??  (    (    (    ( +                ?? 
             ??  (    (    (    (+                 ??  -20 
             ??  (    (    (    +))))))))))))))))))?? 
             ??  (    (    (   +                   ?? 
             ??  (    (    (  +                    ?? 
             ??  (    (    ( +)))))))))))))))))))))?? 
             ??  (    (    (+                      ??  -25 
             ??  (    (    +                       ?? 
             ??  (    (   +))))))))))))))))))))))))?? 
             ??  (    (  +                         ?? 
             ??  (    ( +                          ?? 
             ??  (    (+)))))))))))))))))))))))))))??  -30 
             ??  (    +                            ?? 
             ??  (   +                             ?? 
             ??  (  +))))))))))))))))))))))))))))))?? 
             ??  ( +                               ?? 
             ??  (+                                ??  -35 
             ??  +)))))))))))))))))))))))))))))))))?? 
             ?? +                                  ?? 
             ??+                                   ?? 
             ???????????????????????????????????????? 
             ????????????????????????????????????????  -40 
                     

      The method

      public char determineCharacter (int column, int row);       

      needs implementation, so that it can be called from the nested loop

      String outputLine;  
      for (int row = 1; row <= 40; row++){      
          outputLine = "";      
          for (int column = 1; column <= 40; column++){
      outputLine = outputLine+determineCharacter (column, row);
      } System.out.println (outputLine);
      } Document the body of the method in your report, including a screenshot of it working.

Your report is due by 10.00 pm the night before your next lab! Your report should include any collaborators, summarize what you learned, and note the time you invested in this exercise.


Copyright Prof. Dr. Debora Weber-Wulff
Questions or comments: <weberwu@htw-berlin.de>
Some rights reserved. CC-BY-NC-SA - Copyright and Warranty