User Tools

Site Tools


stringformatter

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
stringformatter [2022/05/23 16:40] frchrisstringformatter [2022/05/23 16:42] (current) frchris
Line 1: Line 1:
 **StringFormatter** **StringFormatter**
 [[https://secure-media.collegeboard.org/digitalServices/pdf/ap/ap16_frq_computer_science_a.pdf|2016 FRQ 4]] [[https://secure-media.collegeboard.org/digitalServices/pdf/ap/ap16_frq_computer_science_a.pdf|2016 FRQ 4]]
-<code>+<code java>
 import java.util.ArrayList; import java.util.ArrayList;
 import java.util.List; import java.util.List;
Line 36: Line 36:
         return spaces - gaps*gapWidth;         return spaces - gaps*gapWidth;
     }     }
-       +
-    public static void main(String[] args) +
-    { +
-        String[] words1 = {"AP", "COMP", "SCI", "ROCKS"};        +
-        String[] words2 = {"GREEN", "EGGS", "AND", "HAM"}; +
-        String[] words3 = {"BEACH", "BALL"}; +
-        String[] words4 = {"IT","IS", "OK!"}; +
-        testItWith(words1, 14, 2, 0); +
-        testItWith(words2, 15, 1, 2); +
-        testItWith(words3, 9, 11, 0); +
-        testItWith(words4, 7, 6, 1); +
-    }+
     public static void testItWith(String[] words, int wordCount, int gaps, int leftOvers)     public static void testItWith(String[] words, int wordCount, int gaps, int leftOvers)
     {     {
Line 68: Line 57:
                  
     }     }
 +    
 +      
 +    public static void main(String[] args)
 +    {
 +        String[] words1 = {"AP", "COMP", "SCI", "ROCKS"};       
 +        String[] words2 = {"GREEN", "EGGS", "AND", "HAM"};
 +        String[] words3 = {"BEACH", "BALL"};
 +        String[] words4 = {"IT","IS", "OK!"};
 +        testItWith(words1, 14, 2, 0);
 +        testItWith(words2, 15, 1, 2);
 +        testItWith(words3, 9, 11, 0);
 +        testItWith(words4, 7, 6, 1);
 +    }    
 } }
 +
 +
 </code> </code>
  
stringformatter.txt · Last modified: 2022/05/23 16:42 by frchris

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki