homework

is there a book overviewing different types of source code metrics ?

Hi I have to submit a paper about the usage of source code metrics in software engineering processes. I thought it would be nice to start by introducing some categorization of source code metrics (for example using plane LOC count Vs doing some static analysis of the code) , but I can't find a book or article that will present the dif...

command_line argument

I can not get the difference between these sentences! would you please write some snippet code for these sentences?thanks The program will receive a path to a directory as the first command-line argument. The program will receive a path to a file as the second command-line argument. ...

Searching for a file with .java extension

Hi, is there any way that at first filter all files with the extension as "java" and then search for finding some files with that extension? can you explain with a snippet code?thanks ...

Copying a file to another

I have a code which at first search for some files that have the "java" extension and then I want to copy the content of one file to these files which has the "java" extension but I don't know that why this code doesn't work? public static void main(String[] args) { if (args.length > 0) { FileInputStream in = null; ...

Trouble using fork() to calculate a total sum of received command line arguments.

I'm trying to calculate the sum based off of sets of numbers received from the command line and I use a companion program called worker to due the computation for me. If the amount of numbers received is odd, it will add a zero to the amount of numbers to make the set even. This is the flow of the program in an understandable way(credit...

C++ Error: explicit qualification

What do these errors mean? Vector.cpp:13: error: ISO C++ forbids declaration of ‘Vector’ with no type Vector.cpp:13: error: explicit qualification in declaration of ‘void Vector::Vector(double, double, double)’ The C++ (Line 13 is the Vector::Vector( ...): #include <iostream> using namespace std; namespace Vector { Vecto...

Why don't all Java classes have interfaces?

I got this question for homework, and I'm not sure how to answer it. Could you help me out? :) ...

What are 3 possible situations in which static methods might be included in classes?

I got this question for homework, and all I can think of is to return a subclass of an abstract superclass. Thanks! ...

Find the big-O of a function

Please help me on following two functions, I need to simplify them. O(nlogn + n^1.01) O(log (n^2)) My current idea is O(nlogn + n^1.01) = O(nlogn) O(log (n^2)) = O (log (n^2)) Please kindly help me on these two simplification problems and briefly give an explanation, thanks. ...

I can't figure out what's wrong

I'm getting this message in error console: Error: uncaught exception: [Exception... "Cannot modify properties of a WrappedNative" nsresult: "0x80570034 (NS_ERROR_XPC_CANT_MODIFY_PROP_ON_WN)" location: "JS frame :: chrome://global/content/bindings/autocomplete.xml :: onxblpopuphiding :: line 834" data: no] I checked everything I'v...

Server and Linked list help needed

Essentially I have built a socket server that multiple clients can connect to and when they send a message to the server it's sent to every other client. The problem is it's not working yet. I need to sort out "SingletonClients" and "getClients" so they return all of the connected users ready for me to send messages to them. It's only a ...

How to use void pointer to create a 2D array in C++?

Hi guys! I was given a question from my prof. that to use a void pointer to create a dynamic 2D array rather than int pointer due to the data type is more general. But I've no idea how to create by using -> void***m // data type is void* pointer Anyone can give an example on this? Appreciate your answer, many thanks! ...

C++ Pac-Man : SDL or Qt ?

Hi everyone, I have to code a Pac-Man clone in C++ for a school project, and I'm hesitating between SDL and Qt for the graphical implementation. I have already a little experience with SDL, but I wanted to give Qt a try. I was asking myself if it is "technically" realisable and if Qt is a good choice for that. I know that it have an an...

How to prove big-o relations

Hey, the title is probably a bit off, so please correct it if you know how to put it better. As a homework assignment I have been given several assignments along the following: Let f(n) and g(n) be asymptotically positive functions. Prove or disprove each of the following conjectures. a. f(n) = O(g(n)) implies g(n) = O(f(n)) Now, my...

Counting elements in a tree in Haskell

Hi Basically I've made a polymorphic tree data type and I need a way of counting the number of elements in a given tree. Here's the declaration for my Tree data type: data Tree a = Empty | Leaf a | Node (Tree a) a (Tree a) deriving (Eq, Ord, Show) So I can define a tree of Ints like this: t :: Tree Int t = Node (Leaf 5) 7 (Node (Lea...

Counting Syllables one char at a time [C]

I'm writing a program which reads text from a file, and determines the number of sentences, words, and syllables of that file. The trick is, it must only read one character a time, and work with that. Which means it can't just store the whole file in an array. So, with that in mind, heres how my program works: while(character != EOF) {...

Inserting values into specific locations in a list in python

I am trying to do print all the possible outcomes of a given list and I was wondering how to put a value into various locations in the list. For example, if my list was [A,B], I want to insert X into all possible index of the list such that it would return this [X,A,B], [A,X,B], [A,B,X]. I was thinking about using range(len()) and a for ...

Dijkstra recurisve

Hi i'm having trouble doing an homework , i've to make recursive version of Dijkstra Algorithm , can somebody help me? ...

What does this mean: O(n) steps and O(1) space?

What does O(1) space mean? I understand that O(n) steps is like the order of magnitude of calculations an algorithm/program makes, but don't know what the O(n) space is. ...

Help Understanding 8bit Floating Point Conversions with Decimals and Binary

I'm in a basic Engineering class and we're going through binary conversions. I can figure out the base 10 to binary or hex conversions really well, however the 8bit floating point conversions are kicking my ass and I can't find anything online that breaks it down in a n00b level and shows the steps? Wondering if any gurus have found anyt...