Skip to content

Programming by Design

If you're not prepared to be wrong, you'll never come up with anything original. – Sir Ken Robinson

  • About
  • Java-PbD
  • C-PbD
  • ASM-PbD
  • Algorithms
  • Other

Category: Code

Comparative Languages

Posted on October 1, 2023July 14, 2024 By William Jojo
Code

(Updated July 14, 2024) String name; int len; name = “Bill”; len = name.length(); System.out.println(name.charAt(0)); System.out.println(name.charAt(1)); System.out.println(name.charAt(2)); System.out.println(name.charAt(3)); System.out.println(“The length of the string is ” + len); String name; int len; name = “Bill”; len = name.length(); System.out.println(name.charAt(0)); System.out.println(name.charAt(1)); System.out.println(name.charAt(2)); System.out.println(name.charAt(3)); System.out.println(“The length of the string is ” + len); String name; int len; name … Read More “Comparative Languages” »

Project 6 Hashing Stuff

Posted on November 17, 2021April 6, 2024 By William Jojo
Code

To get you started on Project 6, here is the basic code to read the checkme.txt file. It reads words, converts to upper case, and strips extraneous punctuation. import java.io.FileNotFoundException; import java.io.FileReader; import java.util.Scanner; public class Main { public static String removeNonLetDig(String s) { int b = 0, e = s.length()-1; // Trim from the … Read More “Project 6 Hashing Stuff” »

What if we didn’t have Character?

Posted on March 13, 2017March 14, 2020 By William Jojo
Code

Consider what things would be like without the wrapper classes. How could we classify chars? For instance, alphabetic, numeric, alphanumeric. Or how could you convert between case? CharEx.java public class CharEx { public static void main(String[] args) { char c; c = ‘a’; System.out.println(c); if ( c >= ‘0’ && c = ‘A’ && c … Read More “What if we didn’t have Character?” »

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Copyright © 2018 – 2025 Programming by Design.