Mary Dawson

Ranch Hand
+ Follow
since Feb 08, 2009
Merit badge: grant badges
For More
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 Mary Dawson

Hi, I have tightened up the program a bit: -


public class arrayProgram7

giving:-



87 is an odd number
90is a factor of 3

C:\Systems Code>
[/code]


I realise that still isn't entirely what I wanted - I just wanted output that would verify if variables in each column met with the three test's criteria, but I think it is on the right path. I have got rid of the 'Out of bounds Exception' s by putting the 'if - do' into the 'for do' loop.

10 years ago
Hi Tony Docherty,
I have again given some thought to the program in question, and think it could be solved without it incrementing column if test criteria aren't met, but could go through all the variables, and if all tests are affirmed, then another test on boolean variables assigned to each test initialised to 'positive' then it will output to screen that that column's variables have met with the three tests criteria, re:-

The problem I am having at present, is that I keep getting a :-

'Exception in thread'main' java.lang.ArrayIndexOutOfBoundsException: 5
atarrayProgram7.main(arrayProgram7.java:42)

message to the console.

This program would run if the second'for do' loop were incrementing rows then columns ie:-

to:-


re:-


but I wanted the columns to be on the horizontal axis, so's the test could apply to each specific row of variables, say the first test:-

to the first two rows, then the second test to the next two rows, and the last test to the last two rows.

There isn't much point in trying to make that work until I have eradicated what is causing the 'Out of Bounds Exception' of course. I could not send any photo of a chart that would illustrate what I wanted the program to do because it won't take notepad, wordpad, Word documents, nor jpgs, which was why I wanted an E-mail address I could have sent it to instead.
Thank you for your assistance.
Yours Mary Dawson.
10 years ago
Re: How to create a program that will test variables in an array, proceeding by row before proceeding by column, that will increment column if test criteria is not met with, or if variables in rows to be tested are exhausted, until all variables in rows have been tested according to successive testing criteria.
(Nb: this is a continuation of the last subject, but as it seems no one is responding since last monday March 25th I thought it worth trying to post as a new topic)
I have given some thought to the objectives of the following program, and thought it would be best to create a multidimensional array of two columns and three rows, that would hold variables initialisable by an xml document, the details of which need not preoccupy us at this point, the program would then test the array's first row first column's variable, then the second row's first column's variable, and then the third row's first column's variable, at any point where the tests criteria is not met with (ie that first variable is not an even number, that the second variable is not an odd number , that the third variable is not a factor of 3) the program will pass to the Array's next column, but the same sequence of rows, ie row 1 column 2, row 2, column 2, row 3, column 2. If the three criteria are met with then program outputs that fact to the screen, and proceeds to increment the column of the Array to be tested.After the second (and maximum number of columns is reached) column value is incremented to Array[maximum] +1, whereby the program ends.



I realise this program is not well coded sufficiently to compile or run, but hopefully it gives an idea of the way in which I wish to solve the problem of putting seperate tests to variables in an array by row rather than by column, and skipping the entire column of rows should test's criteria not be met by the tested variables.
I have drawn another flow chart to describe the layout of the program, which may give a better idea of what I am aiming to create in code, and have a photo of it, if you would be able to give me an E-mail address by which I could send it, seeing as I cannot send photos or appropriate notepad or word documents of such a chart by this gui.
Thank you for reading.
Yours Mary.


10 years ago
Thank you for your assistance, I have given some thought to the objectives of the program, and thought it would be best to create a multidimensional array of two columns and three rows, that would hold variables initialisable by an xml document, the details of which need not preoccupy us at this point, the program would then test the array's first row first column's variable, then the second row's first column's variable, and then the third row's first column's variable, at any point where the tests criteria is not met with (ie that first variable is not an even number, that the second variable is not an odd number , that the third variable is not a factor of 3) the program will pass to the Array's next column, but the same sequence of rows, ie row 1 column 2, row 2, column 2, row 3, column 2. If the three criteria are met with then program outputs that fact to the screen, and proceeds to increment the column of the Array to be tested.After the second (and maximum number of columns is reached) column value is incremented to Array[maximum] +1, whereby the program ends.

public class searchArray
{
public static void main (String [ ] args)
{
int row = 0;
int col = 0;
int [] [] resultArray = new int [3] [2];

// load resultArray- a two dimensional array with variables derived from an xml document;

for (row = 0; row < resultArray[row].length;row++)
{

boolean isEven = (resultArray[row] % 2 == 0);


for (row = 1;row < resultArray[row].length;row++)
{

boolean isOdd = (resultArray[row] % 2 == 1);


for (row=2; row < resultArray[row].length;row++)
{

boolean isa3factor= (resultArray[row] % 3 == 0);


System.out.print ('resultArray[1] [col]
resultArray[2] [col]
resultArray[3] [col] pass tests');
}
}
}
resultArray[row][col++];

if
(resultArray[col].length = resultArray[col]>maximum +1)
{
System exit(0);
}
}
}

I realise this program is not well coded sufficiently to compile or run, but hopefully it gives an idea of the way in which I wish to solve the problem of putting seperate tests to variables in an array by row rather than by column, and skipping the entire column of rows should test's criteria not be met by the tested variables.
I have drawn another flow chart to describe the layout of the program, which may give a better idea of what I am aiming to create in code, and have a photo of it, if you would be able to give me an E-mail address by which I could send it, seeing as I cannot send photos or appropriate notepad or word documents of such a chart by this gui.
Thank you for reading.
Yours Mary.
10 years ago
I have sent the photo in question to Paul Wheaton, as he is the first member of staff on the web page in regard of staff, I don't know if that might be of any help, but at least it took. Anyway the address I sent it to was:- paul@javaranch.com. I will send it to any more convenient address if you will inform me of any such.
It makes the object of the program much easier to grasp. I have been unable to make much progress on coding it, because nothing I have learnt (for do, do while) seems to apply in this case, though.
Thank you for reading this.
11 years ago
Thank you for your response.
I am sorry the photo did not get through, is there any way I can sent a jpg to you independent of this gui ?
I think there is something wrong with this gui as photo's properties are 496 kb and it says they should not be greater than 1024 kb and that the photo has a total of 2125, which is not what my computer says it is. I took the trouble of cropping it by about two thirds, and still this gui won't upload it.
11 years ago
What I want to do is write a java program that will instead of continuing to test a sequence of variables that are initialised say to an array it holds,variables will stop that sequence of variables and repeat using next sequence of variables held in the array should they not meet with the programs criteria, thus working through a pre intitialised array's next set of values to see if they meet the same criteria and repeating the moment they don't. until the array of variables is spent. Hence the variable array in A would be A1,A2,A3, those in B would be B1,B2,B3, program would thus test A1, if it complied with criteria of program it would proceed to read variable in B1, should that comply with criteria then it would be stored and the next sequence be read, starting at A2, but if it should not then it would not get to store those variables, and proceed straight to test A2, until all of arrays variables have been tested. I have attached a photo of the flowchart of the program I had in mind, seeing as this gui mangles it. It said it only had a limit of 1000 kbts but my photo was less than that, I hope you receive it, it makes the whole thing look a lot simpler.
Yours
Mary Dawson

11 years ago
Thank you, I see I am going over old territory.Path is now fixed.
I wanted to ask something else but it is a different topic so will start a new thread.
Yours
Mary Dawson
11 years ago
Hi,thankyou for your assistance.
How could I set class path permanently then, please ?
I wanted to see if the console could access the D: drive to see if the cd command was working, but as you see it returned 'access denied' If I could rectify that too, it would put me in the right direction.
11 years ago
Hi,thank you for your assistance,
I enclose returns to my input to the console, I have got the path to javac established and it is compiling.
As you can see I cannot seem to get the console to look at the same file in the same directory in drive D, stating as it does 'Access denied'. That isn't that much of a problem as I can still put programs within the accessible C drive.

-----------------------------------------------------------
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\User>C:\Systems Code>d:
Access is denied.

C:\Documents and Settings\User>cd C:\Systems Code

C:\Systems Code>javac MyFirstProgram.java
'javac' is not recognized as an internal or external command,
operable program or batch file.

C:\Systems Code>set PATH=C:\Sun\AppServer\jdk\bin;%PATH%

C:\Systems Code>javac MyFirstProgram.java

C:\Systems Code>javac RaceAcceleratorPrototypeone.java
RaceAcceleratorPrototypeone.java:11: not a statement
repeat;
^
1 error

C:\Systems Code>C:\Systems Code>d:
Access is denied.

-----------------------------------------------------------
Also on a different note, program RaceAcceleratorPrototypeone.java won't compile.
Code for this is:-

public class RaceAcceleratorPrototypeone

{

public static void main(String[]args)
{
int counter;
for(counter=1; counter<11; counter ++)
System.out.print(counter + " " );
System.out.println ("\nLoop Finished\n");
repeat;
}
}

I suppose the 'repeat' is a throwback to my induction with Pascal, and its 'repeat/until' statements. All the same I did want this program to go back to the start and output numbers from 1 to 10 ad infinitum, as a basis for other programming constructs. Can you tell me if there is another Java statement I can use to achieve this end ?
11 years ago
Dear Programmers,
I am having difficulty in getting my Command Promt to operate, I lost the one I had due to

cleaning of my c drive, whereby I lost it. I reinstalled it, and it is in a folder C:\ Sun ,

but even though I put that to the path set command, it still won't do the cd: change directory

(ie: cd: ) nor the compiler (javac Program name.java) commands, I have keyed in the following,

which I thought ought to point to the javac command which is in the 'bin' folder, but it

doesn't change the ineffectiveness of the Console's command response, incidentally

'MyFirstProgram.java' is a file in a folder called 'Systems Code', and my computer has another

drive, d:\, which I am unable to navigate to, below is what I am getting :-
______________________________________________________________________________________________
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Documents and Settings\User>set PATH=c:\Sun\jdk1.4\bin;%PATH%

C:\Documents and Settings\User>cd c:\

C:\>cd c:\Systems Code

C:\Systems Code>javac MyFirstProgram.java
'javac' is not recognized as an internal or external command,
operable program or batch file.

C:\Systems Code>

C:\Systems Code>cd d:\

C:\Systems Code>
-----------------------------------------------------------------------------------------------
I don't know if anyone can help me.
Thank you for your help in advance.
Yours
Mary Dawson
11 years ago
Thank you Junilu Lacar, JAXB seems to be what I am looking for.

Yours sincerely,

Mary Dawson
11 years ago
Hi Junilu Lacar,
Thank you for your response.
I have written to the vendor, and they have said the software cannot access an external program direct, but can transfer data, which in this case would be the values that I would wish the program variables to be initialized to, to an XML document or a CSV file.
Therefore what I would wish to do, if possible would be to code a Java Program which can import these values from a XML or CSV document, so that they will automatically initilize the variables that they correspond to. It could be arranged that they initialize to a specific given order, to obviate any consideration of allocation (of value in XML document and the required variable in the Java program) in the coding that would otherwise have been necessary.
Therefore in view of what they have told me, my question would be:-
How may I transfer data given in a specified order within an XML or a CSV document to a Java Program in order to initialise its variables, declared in the same specified order ?

Yours faithfully

Mary Dawson
11 years ago

Hi fellow programmers,
I am not sure if I have the right category for this inquiry but if so I am sure you will tell me, and where I ought post it instead.
I am interested in developing a few Java programs that will use variables that would be initialized by a web data extraction software.
The data would change on a daily basis and so the outcome of the Java program would change accordingly, but my main concern is : Could the variables in a program be arranged to be initialized by the extraction software seeing as the software would be external to the program ? Would there be a way of accessing initialized program variables direct from the software once software has defined their values, even though these Variable values would be in the software ?
I realize you may be thinking 'why don't I ask the software people ?' - Well I will, but you've got to start somewhere. For what its worth the Software I was considering is called 'Powerseach' which says it can pinpoint specified data, which is more or less what I am looking for, but once it has got the requisite data I would then want to run it in a Java Program, and bearing in mind that I would need to use both software and Java Program to re-initialize these variables on a daily basis.
I hope you can help me with this problem.
Thank you for your help in advance.
Yours
Mary Dawson.
11 years ago
- and no program wasn't really called 'My First Program' , it was called something else.
12 years ago