A Issa

Greenhorn
+ Follow
since Mar 26, 2011
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by A Issa

Nevermind on the last post. I got it

Thanks,
A
13 years ago
Thanks for the respond Campbell. I think I got it. I have another question though, if I want to create 100 random Circle object, each with a random location within the panel and a random radius from 1 to 20 with a loop how can I do that? I know that I need to use an array to do this. But I don't want any circle that intersect the big circle. This is the code that I have so far:
13 years ago
Hi;
I am creating my own class in my program. I am suppose to create a big circle that has another circle inside, another one outside, and finally another one intersecting it. I have a circletester, and a drawing panel. So far this is what I have for my program:

I am suppose to create a public boolean inside(Circle c2) to test if the circle is inside the circle and I am having trouble creating that. If anyone can help I will appreciate. Thanks, A
13 years ago
Thanks the return resolved the problem. And you are right I am returning an empty string. Am I missing an if...else statement??
14 years ago
Hello this is my first time using a forum for help. I am doing a java program to create a caesar cipher. I am getting an error of (This method must return a result of type String) on the public static string encrypt(String text, String theKey) and another error where (text cannot be resolved to a variable).

This is the instruction: Develop code to encrypt a string given the following encryption key "DEFGHIJKLMNOPQRSTUVWXYZABC". The encryption key is positional, so that the letter A is replaced by D, B is replaced by E, etc. We will ignore case in our substitutions.

To implement Stage 1, you should write a static method named encrypt :

public static String encrypt(String text, String theKey)

This method takes in the string to encrypt (named text) and the key and returns the encrypted string.

If you are confused about how to proceed, then here are some steps you can take:

define a class constant outside the method :
public static final String ALPHABET = "abcdefghijklmnopqrstuvwxyz";
Inside the method, create a new string which is a lower case version of the parameter "text". We will replace the lower case characters with upper case key characters from the key so as to avoid the problem of replacing a character twice.
Create a loop that considers each character of the key (loop 26 times). Inside the loop :
extract the ith character from the key using the string method charAt.
extract the ith character from ALPHABET
call the replace method of the lower case text, changing the ith character of the alphabet to the ith character of the key.


And this is what I have so far for the code
[B]

Please help,
Thanks
14 years ago