I solved the print portion of it, yes :)
I am curious about abstract though. I'm using the abstract method ArrayDrawer for this program (Since my book showed using that for a similar example). ...
Type: Posts; User: Wonderlandslost
I solved the print portion of it, yes :)
I am curious about abstract though. I'm using the abstract method ArrayDrawer for this program (Since my book showed using that for a similar example). ...
arraydrawer.ArrayDrawer is abstract; cannot be instantiated
Surround with ...
That is what the compiler I'm using is telling me as the error for;
public static void main(String[] args)
...
The problem I'm trying to solve is creating an ArrayDrawer class that has the arrays square[] and triangle[] (as listed in code). I have to take those and add them into the first open position. I...
I'm working on a program with a main class; ArrayDrawer and two subclasses; square and triangle. Here is what I've gotten so far;
public abstract class ArrayDrawer
{
//Global Data
...
I'm still unsure. However, my instructor cancelled the project and assigned a new one in its stead. I will return to this project as soon as I can, just so I can understand it better, but as of...
I honestly don't know at this point. I'm really lost in the program. I went through the book and added in things from the example that was provided, but I'm not sure..
public class Drawer...
I can't figure out what datatype myShape is. I've never declared an array without saying 'string' or 'int'...
As for the datatype of z, it's a double.
In this case, would my array be an int...
public double add(double z)
{
//Use the findFirstEmpty to locate the first null spot
int x = findFirstEmpty();
//Take the empty spot and put the item in it
if...
So my instructor assigned us to create a program that calculates the area and stores that, along with coordinates, in an array. This has to be done for both triangles and squares. He is having us...
Okay, I reviewed the chapters and figured out the meaning. That means not equal to.
I do not know that the != operator does. I do know that that will be true when there is an empty spot, or a null spot, in the array.
I also ran the program, printing out what x was from the...
So, I tried doing what you said, I had troubles with it, but i was looking at the code once more and it looks as if the findFirstEmpty is only returning -1.
It'll go through the for loop...
I was mistaken, thinking that names was something I could use there. I corrected that. I'm now testing in my main method;
/*
* Author: Rachel Moss
* Class: CS 3100
* Teacher: Dr....
/*
* Author: Rachel Moss
* Class: CS 3100
* Teacher: Dr. Silverman
*
* Compiles:
* Works:
*/
package schoolbus; //Check this portion 2/10/12
Okay, now I'm having some troubles with the test method and my getOn method;
public String sample(String name)
{
name = "Anna";
names.getOn(name);
return name;
...
I've tested them. They all work so far. I'm just confused how to get the name in there to set it to null. I thought that using if x>= 0, then following that with names = null; would work. And...
It was put into the array and then set out so that it could get more information. So, would this one need to return anything at all, since it is merely setting a portion to null once more?
And...
I'm not sure to the first question, I'm not sure how to go about doing that. As for why it returns a string, perhaps it doesn't. I've changed it slightly to have it return null, since I am changing...
getOff is supposed to take the array and find a specific name, it then has to take that and set it back to null, which virtually represents the child getting off of the bus. I think that it is...
In regards to the getOff function, since it is similar to getOn by way of what it's doing, only reverse, would it be possible to do something like this;
public String getOff(String name)
...
Okay, I'm not completely sure I'm following, but would it be the fact I have x != -1 instead of x == -1?
Would it be something along the lines of this;
int x =findFirstEmpty();
//Take the empty seat and put the child in it
if (x != -1)
{
//indicates...
Since I returned the -1 value to indicate that it was a full array. I thought that by stating that the x value I pulled from findFirstEmpty was equal to -1 in the if statement, I could have the...
So, I wouldn't need a return? Or would I need to return something else, like the original string name instead of the array string names?
Something like;
public String getOn(String name)
...
Well, as far as I understand, the program requires us to push string names, such as anna, into the getOn method through the main method. Since I'm assuming that name is going to be the string that...