id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

siochi@cnu.edu > mkSquare
prev  |  next  |  chance

Write a method that creates a String that represents a square of a given dimension. A square is created by adding the appropriate number of stars ('*') to the string. Think of creating it in slices. To indicate the end of a slice, put a newline (':') after the last star in that slice. For example, a square of side 3 is represented by the string "***:***:***:".


mkSquare(3) → "***:***:***:"
mkSquare(1) → "*:"

...Save, Compile, Run (ctrl-enter)

public String mkSquare(int side) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 110

Copyright Nick Parlante 2017 - privacy