Monday, May 19, 2008

I am working on a java program to determine if numbers in a series are odd or even. below is what i have so far

import java.util.Scanner;

public class EvenOdd
{
// determines whether numbers are even or odd
public void checkEvenOdd()
{
// create Scanner
Scanner input = new Scanner( System.in );
// obtain user input
System.out.print( "Enter three floating-point values seperated by spaces:" );
number = input.hasnext();

input = input;
}
while ( input.hasNext() )
{
int number = input.nextInt();

if ( isEven( number ) )
System.out.printf( "%d is even\n"- number );
else
System.out.printf( "%d is odd\n"- number );
} // end while loop
} // end method checkEvenOdd

// return true if number is even
public boolean isEven( int number )
{
return number % 2 == 0;
} // end method isEven
} // end class EvenOdd

I am working on program based on user input of radius to determine area- below is what I have so far. PLease make corrections on the below code.

import java.util.Scanner;
public class Circle
{
// calculate the areas of circles
public void calculateAreas()
{
//create scanner for input from command window
Scanner input = new Scanner ( System.in );

double radius = input.nextDouble(); // radius

// get the first radius
System.out.print( "Enter the radius (negative to quit): " );
double radius = input.nextDouble();

while ( radius >= 0 )
{

// call a procedure circleArea with a radius
circleArea( radius );

// get another radius

} // end while loop
} // end method calculateAreas

// calculate area
public void circleArea( double radius )
{
System.out.printf( "Area is %f\n"- Math.PI * radius * radius );
} // end method circleArea
} // end class Circle

I bought the 5 gallon plastic fish tank with plastic cover at PETCO. Lets just put it this way that its the cheapest fish tank possible. Anyways I already have good sized grave which is colored multi colors. I will try to buy a cheap but good filter. I will buy plants such as elodea and maybe some java fern. I will not buy a light or heater because I will just use a desk lamp light over the fish tank to provide light for the plants and warmth for the fish. I live in Los Angeles so it never gets really cold and the light will keep the temperature generally at 80 degrees.

I want to buy a beta fish.
First off will it do okay in this tank?

Secondly can I put ghost shrimp or cherry shrimp in the tank with the beta?

What other type of wildlife can I put in the tank with the beta?

Thankyou for answers

PART 1

Ceasar s Cipher
Imput a key
Input a string(Plaintext)
Output a Ciphertext

PART 2


Input Ciphertext
Output Plaintext
Output key

No comments: