My last return statement does not work can anyone tell me why? I am completly lost!
public class IpAddress
{
private String dottedDecimal;
private int[] Octet= new int[4];
public int i;
//Default constructor
public IpAddress()
{
dottedDecimal = "0.0.0.0";
for ( i=0; i<=3;i++)
{
Octet[i] = 0; //setting the array to zero
...
I'm trying to make my own tree class but keep getting horribly confused. Basically I'm trying to make a weighted tree. I've made the following node class:
import java.util.*;
public class subdivNode {
private int nodevalue;
private int nodeID;
private List<subdivNode> childnodes;
public subdivNode(int value, int id){
nodevalue = ...
Hi,
I am trying to write a simple UTF-8 decoder for my assignment. I'm fairly new with C++ so bear with me here...
I have to determine whether the encoding is valid or not, and output the value of the UTF-8 character in hexadecimal in either case. Say that I have read the first byte and used this first byte to determine the number of b...
I want a program that takes an int x as parameter and returns 2^x. The implementation is not allowed to use power of.
public int double2 (int x) {
int r = 2;
int y = 1;
for (int i=0; i < x; i++){
y = r* y;
}
return y;
}
Do you think this is a right solution?
...
How can I convert this string:
This string contains the unicode character Pi(π)
into an escaped ascii string:
This string contains the unicode character Pi(\u03a0)
and vice versa ?
The current Encoding available in C#, converts the π character into "?". I need to preserve that character.
...
When storing and manipulating sparse matrices on a computer (zeros and ones), it is beneficial and often necessary to use specialized algorithms and data structures that take advantage of the sparse structure of the matrix. Operations using standard matrix structures and algorithms are slow and consume large amounts of memory when applie...
Hi all.
Frankly this is part of my uni assignment, BUT I have already done quite a bit... so please feel comfortable and keep reading since I am not asking for a cheat sheet or so :)
The project is now deployed on my website
Okay, I might have found the reason just minutes ago:
array_push() fails after pushing many items in an ar...
I am creating an array named "fifty" with 50 elements.
Instruction #1:Initialize the array so that the first 25 elements are equal to the square of the index/key variable.
When squaring we are raising a base or number to some power so in PHP
we need some function like this:
<?php
print pow(10,2); // Squared raised to the 2nd power...
I'm pretty new to SQL and please bare with me while I explain this as it is quite hard to explain.
I have 3 tables:
Trip Promotion Promotion Cost.
1 ---- M 1 --------- M
Sample data include:
TripID TripName Date
XYZ123 Hawaii 09/06/09
YTU574 Japan 09/09/09
GHR752 US 11/07/09
PromotionID T...
Hi,
I have an xmlnodelist in C# I would like sort by ID without creating arrays.
The XML data is loaded into a dynamic table I've created.
I haven't studied a lot XPATH but I figured out by Googling the attached code could work.
Howevern, I would like to get the sorted output back as an xmlnodelist in order to create the dynamic table ea...
We just got our first major Perl CGI assignment in my CS class. Our task is to create an mp3 sharing site that allows users to create accounts, log in, share mp3's. Statistics must be shown of current users, mp3's available, etc. All actions must be written to a log file. Our code must be secure.
So far, I have implemented each of th...
Hi,
Need to be able to either sort or insert entries to a linkedlist in alphabetical order.
Is there a good way to do that?
...
I have a coded a program GUI phone book. It has textfields such as name, address, city,..etc. I also have three buttons. Add, clear, quit. My program is serializable using a thread to write to my disk file every 2 sec. a new address. How do I code the quit button to quit running and writing to the disk?
...
I have just started coding my Computing project for my A-Level, and I will admit, I am far more experianced in 6 than .NET (as embarrassing as that is to say).
I get extra marks for making everything presentable, so was wondering if it was possible to add icons into .NET buttons. For example if I have a button to add an entry to the dat...
SHould be implemented in PHP.
...
This is a homework task, but it's very simple. The task comes with a working assembly file. I just need help to compile it on linux instead of windows. I'm using Ubuntu. I've installed mingw32. The task itself is to add some functionality, not compiling it.
The file itself is here: here. To much code for including it, and besides the c...
I am supposed to create an iterative method stretch that takes a positive number n as a parameter and returns a new ListItem beginning a list in which each of the numbers in the original list is repeated n times. For example, if the original list is ( 6 7 6 9 ) and the parameter value is 2, then the new list returned is ( 6 6 7 7 6 6 9 9...
I am working on a 4 x 4 bit multiplier and am getting this error message, "Error (10500): VHDL syntax error at lab_6.vhd(33) near text "after"; expecting ")", or ","" twenty times. The problem is I have a ")" or a "," after the after statement. Here is the code:
library ieee;
use ieee.std_logic_1164.all;
entity lab_6 is
port(x, y...
I'm stuck on part of my homework, I had to find the rightmost occurrence of a substring inside of a string. I have the first part done (can find substring in single word strings), but now I am having trouble with the second part. I have to use a modified version of getline in order to allow multi-word strings (aka with spaces). Here's...
I've been instructed to created a model strdup
char* modelstrdup(char* source);
-- This function is a mirror of the
standard C library function called
strdup. The parameter is a string that
we wish to duplicate. The returned
pointer will point onto the heap. When
you write this function, create a
String struct on the hea...