In the programming language of your choice, write a program that accepts an array of words, and calculates the number of vowels. For example, Given:
['hello', 'world']
Produces:
a: 0
e: 1
i: 0
In the programming language of your choice, write a program that accepts an array of words, and calculates the number of vowels. For example, Given:
['hello', 'world']
Produces:
a: 0
e: 1
i: 0
require "formula" | |
class Bashmarks < Formula | |
homepage "https://github.com/huyng/bashmarks" | |
url "https://github.com/daveharris/bashmarks/archive/1.0.tar.gz" | |
sha1 "53010ce4f613e5e30070ceae01eee5526f3063b2" | |
version "1.0" | |
def install | |
system "make", "install" |
Dir["**/*.rb"].each do |file| | |
contents = IO.readlines(file) | |
open(file, "w") do |f| | |
f.puts "module MyModule\n" | |
contents.each { |line| f.write " #{line}" } | |
f.puts "\nend" | |
end | |
end |
import java.io.File; | |
import java.io.FileNotFoundException; | |
import java.util.ArrayList; | |
import java.util.Scanner; | |
public class TestResults { | |
public static void main(String[] args) throws FileNotFoundException { | |
ArrayList<Integer> scores = new ArrayList<Integer>(); | |
Scanner scanner = new Scanner(new File("test_results.txt")).useDelimiter("\\n");; |
Set<Kitten> kittens = KittenDaoImpl.all(); | |
Iterator iter = kittens.iterator(); | |
while(iter.hasNext()) { | |
Kitten kitten = iter.next(); | |
if (kitten.isCuteAndAdorable()) { | |
iter.remove(); | |
} | |
} |
I have found the layout of SWT rather esoteric, and the javadoc is really bad, it doesn't say what the meaning of the argument is, so you have stuff like:
GridLayout gridLayout = new GridLayout(2, true);
which means you have 2 columns and they are each of equal width. To make this more readable/understandable, I propose two otions...
We can name the parameters like so;
int numColumns = 2;
boolean makeColumnsEqualWidth = false;