Hello all!
I have a bit of a problem with the algorithm proposed as homework by our teachers. It goes something like this:
Having a number of sticks like so:
4 (the number of piles to use)
11 7 5 4 (length of the sticks)
1 1 3 3 (how many sticks per length)
I have to figure out an algorithm that will form the minimal number of sti...
Fixed the problem with the following code - not the most gracious way - but i need a quick solution for this assignment
package six.desktop.gui.common;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.URL;
public class Config
{
private static final String configFileName =...
I need to write a program in Java to generate random numbers within the range [0,1] using the formula:
Xi = (aXi-1 + b) mod m
assuming any fixed int values of a, b & m and X0 = 0.5 (ie i=0)
How do I go about doing this?
i tried doing this but it's obviously wrong:
int a = 25173, b = 13849, m = 32768;
double X_[i];
for (int i = ...
Hello,
I am working on a assignment where I am supposed to read a file and count the number of lines and at the same time count the words in it.
I tried a combination of getline and strtok inside a while loop, which did not work.
file:example.txt (the file to be read).
Hi, hello what a pleasant surprise.
Welcome to this place.
M...
Is it acceptable to assign 'NULL' to a boolean datatype?
...
So basically what I want to do is a program that asks the user how big he wants his array to be and for the user to introduce the values inside the array. Then I want the user to be able to introduce a number and for the program to determine in which array the number is or determine that it doesn't exist. The following program currently ...
I don't understand if the calculation for netPay = grossPay - (fedtax withholding + social security tax withholding). Are my calculations correct within the program? Dealing with such in editedTax?? If someone could help I'd appreciate it.
More info: When I display netPay within an output, I receive a runtime error, where I couldn't c...
Description of Scenario for project: To search and articles in a library computer system one uses keywords in combination with Boolean operators such as 'and'(&) and 'or(). For example, if you are going to search for articles and books dealin with uses of nanotechnology and bridge construction, the query would be Nanotechnology & bridge ...
I'm trying to figure out how to give a worst case time complexity. I'm not sure about my analysis. I have read nested for loops big O is n^2; is this correct for a for loop with a while loop inside?
// A is an array of real numbers.
// The size of A is n. i,j are of type int, key is
// of type real.
Procedure IS(A)
for j = 2 to l...
Currently I am studying for my Java test. Whist studying I've come across a small problem.
In this for loop:
for ( int i=1; i <= 3 ; i++ ) {
for (int j=1; j <= 3 ; j++ ) {
System.out.println( i + " " + j );
}
}
The output is:
1 1
1 2
1 3
2 1
2 2
2 3
3 1
3 2
3 3
My problem is, I don't understand it. When I read thi...
I want to make a rational number calculator, but I don't know how to neglect some characters. E.g., if the program has to calculate the expression "2/9+9/3" and the answer should be in unsimplified form, how to neglect '/' in the above expression while taking input?
...
I have a program I am writing that works on the principle of populating a two dimensional array to check the winning condition, it's noughts and crosses so the two dimensional array is populated on the click of a button, 1 for a circle, 2 for a cross, then the checkWin() will work on this principle, not the actual code...
if (myArray[0]...
How do I divide two integers to get a double?
...
respected sir,
we are the students of andhra university our project is image transport protocol.only 20% of my project is completed, we implemented RSA enc and dec, text comp and decompression but we don't implement image comp and decompression and image to text conversion and text to image conversion and tommarow is last date for submi...
I need to design an application that resembles an internal mailing system. However, this is just a course project. No networking required. The professor is just making us put the discussed data structures to work. However, I have been having trouble deciding how to design the application. Let me explain briefly what I have to do and then...
Consider i have a string "011100011".
Now i need to find another string by adding the adjacent digits of this string, like the output string should be "123210122".
How to split each characters in the string and manipulate them.?
The method that i thought was, converting the string to integer using Parsing and splitting each character u...
I need to do a program to download the webpages, that is, I give a webpage to the software and it would download all the files in the website.
I would pass also a level of depth, that is, the level where the software goes download each file of the website.
I will develop this software in Java and I need to use concurrency also.
Please...
I'm not asking for anyone to do this homework for me, but I bring it up because it's a very good practical introduction to C# and threading, but at the same time I feel it's perhaps a little too simple.
Is this really the best way to teach threading? what key threading concepts are "lost" in this exercize, what would new programmers u...
I can understand how one can write a program that uses multiple processes or threads: fork() a new process and use IPC, or create multiple threads and use those sorts of communication mechanisms.
I also understand context switching. That is, with only once CPU, the operating system schedules time for each process (and there are tons of ...
I want some help that is related to J2ME.
I don’t know a lot about J2ME and now I am required to do a mobile application (it is a course project).
My application must be connected to the database, so I don’t know what should I do to do this project!
Some students said that I should to do a web server that connects to the database and ...