public class Vowels
{
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
System.out.print("Please enter a word: ");
String word = in.next().toLowerCase();
int count = 0;
for(int i = 0; i < word.length(); i++)
{
String letter = word.substring(i, i + 1);
if ("aeiouAEIOU".contains(letter))
{
count++;
}
}
System.out.println(count + " vowels");
}
}
public class Negative
{
public static void main(String[] args)
{
Picture pic = new Picture();
pic.load("eliza.png");
pic.draw();
pic.pause();
for(int i = 0; i < pic.pixels(); i++)
{
Color c = pic.getColorAt(i);
Color negative = new Color(255 - c.getRed(), 255 - c.getGreen(), 255 - c.getBlue());
pic.setColorAt(i, negative);
}
}
}
public static void main(String[] args)
throws FileNotFound Exception
{
File inputFile = new File("input.txt");
Scanner in = new Scanner(inputFile);
while (in.hasNextDouble())
{
double value = in.nextDouble()
}
}
public class Colors
{
public static void main(String[] args)
{
final int WIDTH = 30;
final int ROWS = 16;
final int COLUMNS = 16;
for (int i = 0; i < ROWS; i++) { for (int j = 0; j < COLUMNS; j++) { int x = WIDTH * j; int y = WIDTH * i; Rectangle rect = new Rectangle(x, y, WIDTH - 1, WIDTH - 1); int blue = i * 255 / (ROWS - 1); int green = i * 255 / (COLUMNS - 1); Color fillColor = new Color(0, blue, green); rect.setColor(fillColor); rect.fill(); } } } } [/java]