Nick Hallloran

Greenhorn
+ Follow
since Feb 09, 2010
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Nick Hallloran

The question is pretty long so i will do my best to explain it..(The Rectangle class) Design a class named Rectangle to
represent a rectangle.

The class contains:

-
Two double data fields named width and height
that specify the width and height of the rectangle. The default values are 1 for both width and
height.

-
A string data field named color that specifies
the color of a rectangle. Hypothetically, assume that all rectangles have the
same color. The default color is white.

-
A no-arg constructor that creates a default
rectangle.

-
A constructor that creates a rectangle with the
specified width and height.

-
The accessor
and mutator methods for all three data fields.

-
A method named getArea() that returns the area
of this rectangle.

-
A method named getPerimeter() that returns the
perimeter.

Draw the UML diagram for the class. Implement the class.
Write a test program that creates two Rectangle objects. Assign width 4 and height 40 to the first
object and width 3.5 and height 35.9 to the second object. Assign color red to all Rectangle
objects. Display the properties of both
objects and find their areas and perimeters.

My question is that i keep gettin this error...Rectange.java:59: RectangleDemo is public, should be declared in a file named RectangleDemo.java
public class RectangleDemo {

10 years ago
I am having troubles combing both arrays to execute within the loop. I have confused myself way to long with this simple program. I am supposed to write a program that reads 10 numbers and displays the distinct numbers. Example layout of the output is:

Enter an integer: 1
Enter an integer: 3
Enter an integer: 2
Enter an integer: 1
Enter an integer: 5
Enter an integer: 4
Enter an integer: 5
Enter an integer: 2
Enter an integer: 4
Enter an integer: 5
The number of distinct values is 5
1 3 2 5 4

My code is:
10 years ago
haha wow i cant believe i missed that one....Thanks Alot!
10 years ago
The question is to write a method that finds the smallest element in an array of integers. I have to use 1, 2,4,5,10,100,2,-22 to test the method. My program is able to compile but it wont run. If anyone could help it would be much appreciated.

Here is my code:

10 years ago
haha wow! I cant believe i missed that...yea it definitely hurt falling out of my chair
10 years ago
I need to sort three numbers in ascending order. The first two are properly done but the third number that is entered always shows up as the first number...just wondering where i am going wrong

10 years ago
yea i can get it to compile now no problem..but my problem is that when i execute the program all it says is what i rolled not if i won or lost.
10 years ago
I was thinking maybe because i put a closed brace at the end of the main method..but i removed it and added on at the very end and that didnt work either.
10 years ago
ok so i deleted to of the braces..but now all it says is what i rolled...not if i win or lose.... I thought my code was correct...but somewhere im going wrong and i cant find it
10 years ago
This is what it says after i compile the program

class, interface, or enum expected
}
^
1 error


10 years ago
YES it is! Thank You Very Much! After looking at it, i realized how easy it actually was and that i was over thinking it!
10 years ago
Ok this problem is driving me crazy! I have to get a pyramid that has 8 rows and as the number goes down in each column it multiplies by two. I have a simple program that i made that has the pyramid in 8 rows that has the same numbers in each column. My problem is that i cannot figure out how to change the format of the columns to what i need

The code that i have is:


As you can see the column numbers are all the same. I need them to multiply by two as it goes down. For example, the column with all ones would read from top to bottom 1, 2, 4, 8,16, 32,64,128.

Any help will be much appreciated!
10 years ago
The problem asks me to list numbers from 10,000 to 100,000 on the left side and the PI value for every 10,000. Everything is correct except for all of the decimal numbers that pop up. for example,
10000 multiplied by PI is 3.1415.8999999998. I have read on this else where, and everyone suggests using the decimal format, DecimalFormat("#,###.##"); , but unfortuantely i have not been taught that yet, so i can't use it. I was thinking of using the % operator..but still cant figure out how to do it.
10 years ago
Hey everyone,

My program runs perfectly except for one thing. On the result side, the numbers have alot of unwanted decimals. Im looking to go to the tenth value. Any help would be appreciated.



Thank you again!
10 years ago
OH ok i understand now....thank you very much for your help...keep watching this forum..because more than likely i may have another question pop up when i aget assigned another set of problems.
10 years ago