Jump to content

Search the Community

Showing results for tags 'codingbat'.

More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • RuneLocus
    • News & Announcements
    • Information Booth
    • Website Support
    • Introductions
    • Chat
    • Forum Games
  • RuneScape Development
    • RSPS General
    • RuneScape Private Server (RS2)
    • RuneScape Private Server (503+)
    • RuneScape Private Server (EoC 742+)
  • Other
    • Digital Art
    • Gaming
    • Webdevelopment
    • Computers
  • Marketplace
    • RuneScape Market
    • RSPS Market
    • Others Market
    • Freelance Middleman Services
  • Super Secret Club's Topics

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start



Found 2 results

  1. Alright, so - the problem! (These are using loops) Given a string, return a string where for every char in the original, there are two chars. doubleChar("The") → "TThhee" doubleChar("AAbb") → "AAAAbbbb" doubleChar("Hi-There") → "HHii--TThheerree" [CODE] public String doubleChar(String str) { String answer = ""; for (int i = 0; i<str.length(); i++) { str.substring(i, i+1); } for (int x = 0; x < str.length(); x++) { answer += str; } return answer; } [/CODE] The output so far is like this hihi instead of hhii :( Also, don't know where to start on this problem.. Return the number of times that the string "hi" appears anywhere in the given string. countHi("abc hi ho") → 1 countHi("ABChi hi") → 2 countHi("hihi") → 2 I DISCOVERED WHILE LOOPS AND IM JIZZING K LOL Return true if the given string contains an appearance of "xyz" where the xyz is not directly preceeded by a period (.). So "xxyz" counts but "x.xyz" does not. xyzThere("abcxyz") → true xyzThere("abc.xyz") → false xyzThere("xyz.abc") → true [CODE] public boolean xyzThere(String str) { String other = "xyz"; String otherz = "xxyz"; while (!str.contains(other) || str.contains(otherz)) { return false; } return true; } [/CODE] ^ I get most right but I still get like a couple wrong :/ My teacher sucks ass at teaching so I don't really know how to do these blargh... Just need help getting started...
  2. Can someone please explain to me why this is wrong? [CODE]public boolean makeBricks(int small, int big, int goal) { int inch = big*5; if(goal >= inch) return(goal-inch <= small); else return(small >= goal || (goal-small)%5 == 0); }[/CODE] the problem can be found at [url]http://codingbat.com/prob/p183562[/url]