Cool, and I won't ask for C advice here, but there are no problems with writing a server in C and a client in Java are there? As long as the port is the same and all that good shtuff?
Type: Posts; User: Zula
Cool, and I won't ask for C advice here, but there are no problems with writing a server in C and a client in Java are there? As long as the port is the same and all that good shtuff?
What is the best method to accomplish getting data from my computer to a server so that I can then view it in a applet in a browser?
I have a sensor attached to my computer, I already have that...
I believe the problem is that switching the sign of denom makes it so when you ADD two each time, you are not always adding to the absolute value of the number, as adding to a negative gets it closer...
Check out the charAt() or indexOf() methods of the String class
this link : Java 2 Platform SE 5.0 Will tell you about the next() methods, nextInt() is to get a number, you want next() or nextLine()
With yours, if you don't pop the queue, and keep using front() it'll be the same thing repeatedly. Also if you use Size() in the for loop and pop, you will be counting up and lowering the count so...
will print the front item in the queue repeatedly without changing it.
as the last part of the for loop means it WILL be in the from but the if empty works fine just pointless
There is one problem, the for loops that use MyQueue.Size() and pop() together are cut short as pop reduces size, make a variable to remember the original size before you start the loop...as such:
...
In that example what happens between "After Iteration 1" when the from queue is empty and "Iteration 2" where it has data...you must transfer it...
There appears to be a problem with your MyQueue or DoublyLinkedList classes...the to queue is not growing properly. my mistake not true..same poping reducing size problem
Hmm...well, you need to empty from as you go through it or it will build up, but I see that doing so changes Size() and makes me run out faster than I should.
Problem though, the final sequence from the generator-koch.txt file has spaces for some reason...so an error in the code somewheres
make it str = console.nextLine().trim(); in the penguin loop
...
// this class takes in productions and generates turtle commands.
import java.util.ArrayList;
import java.io.*;
import java.util.*;
public class program6_part_3
{ // beginning of class...
I misspoke, it ends in the "from" queue, so print from the "from" queue
No offense but your teacher's outline is a bit weird, steps 1&2 are on a different scope than 3,4,5&6, 4,5&6 should have been under 3 and it should have been worded different....but anway, okay, the...
for (int iter =0; iter < numberOfIterations; iter++)
{ // beginning of for
for (int iter2 = 0; iter2 < from.Size(); iter2++)
{ // beginning of for
if(leftSide.contains(from.front()))
{ //...
Still use two circles, since the repeated part has two circles.
for(int i = 200;i>=20;i-=40) {
Circle c = new Circle(250, 250, i);
Circle c2 = new Circle(250, 250, i-20);...
Make a for loop that goes to.length iterations and pop them from the 'to' queue into the 'from' queue
for(int asdf = 0;asdf<to.length();asdf++) {
from.push(to.front());
to.pop();
}
For the generator-koch.txt file, I get
F-F++F-F++F-F++F-F++F-F++F-FF-F++F-F++F-F++F-F++F-F++F-FF-F++F-F++F-F++F-F++F-F++F-FF-F++F-F++F-F++F-F++F-F++F-FF-F++F-F++F-F++F-F++F-F++F-F
as the...
It appears it would yes.
But what you need to do is in the for loop, once you read in a production, stick it in two queues, one for the lhs(from) and one for the rhs(to)
static Scanner in;
public static void main(String[] args) throws IOException {
in = new Scanner(new File("generator-koch.txt"));
for(int i = 0;i<6;i++) {
...
He means make a queue of all the chars in the starting sequence, then for each char, check if it is a lhs(left hand side) symbol, if so, take the corresponding rhs and substitute the symbol
With scanner.next() it gives you what is inbetween spaces, so if you use
for (int penguin = 0; penguin < numberOfProductions; penguin++)
{
// should read in single character that is on left...
Alright, try this, post a(1) specific-ish question, and the part of the code that goes with it