homework

reading in numbers using strings

I need to code a function that will take in x numbers. (x is read into the function as an argument) The numbers can be preceded and separated by any number of white spaces and new-lines, and after the last number is entered, a new-line character ends the scan. I thought about using strings the take in characters, and to disregard any non...

InputMissMatchException

I want to read data about MMORPG characters from a .txt file and then filter on experience (minimum experience). But I'm getting this exception, which I know the meaning of but I really don't understand what I'm doing wrong. this my code: I'm not good at java, I'm a beginner actually. Can someone please explain this to me. Probably I'm ...

Tree java how to find a word

I am trying to read a node that will find the longest word in a tree. My method is public static int word(Node d). So how would I have to find the length of that node? Would I just use the string that was made in the class? The class I would use initializes a boolean, String: theWord and children. Here is what I got: int newWord = 0; ...

Prolog A predicate for alignment

By alignment I mean that the predicate takes in two lists, well three with the alignment list. And then check that every item in the alignment list is indeed an element in both the other lits. And there is a requirement about order, so that rules out just checking that every item in the alignment list is a member of both the other input ...

How to fix this bubble sort program?

package arraySort; import java.io.IOException; import java.io.File; import java.util.*; public class openFile { int x; static int i; static int[] myList = {100}; public static void main(String[] args){ try{ File myFile = new File("arraySort.txt"); Scanner scan = new Scanner(myFile); ...

Solving a game using two 3x3 matrices

Hi I have two 3x3 matrices. One representing the actual state and the other in a "current" state. Actual state -> 1,2,3 5,7,6, 9,8,x Current state1 -> 3,1,2 x,6,7 8,9,4 I need to bring the current state matrix to the original state by doing only swaps of element x a...

what is the difference between web servers and application servers?

what is the difference between web servers and application servers? I have googled but couldnt get clear... ...

List implemented using an inorder binary tree

For the new computer science assignment we are to implement a list/array using an inorder binary tree. I would just like a suggestion rather than a solution. The idea is having a binary tree that has its nodes accessible via indexes, e.g. t = ListTree() t.insert(2,0) # 1st argument is the value, 2nd the index to insert at t.get(0) # ...

A bare-bones DNS server.

I have to implement a DNS server in C and I don't know where to start. What are all the features that a DNS has...how can I implement a bare-bones DNS in single C file. I don't even want to use a Database, just a file will work. Thank you in advance ...

java binary search tree

Hello. I have a question about how would I remove a child from a node (root)? Since I can't call remove, if I make the child null, will the children of that child move up? Like, would I just initialize it as null?? Or would I point to the child's child? ...

Why doesn't my Refresh header work?

Hello stackoverflow, I'm working on a homework assignment in Perl CGI using the CGI.pm module. In my code I am checking for a cookie. If the cookie exists, I want to initiate another CGI script. In other situations I was able to use similar code, but in this instance I merely get the following browser output, not the redirect that I w...

Currying and compiler design

This is a homework question: Explain the transformations the type of a routine undergoes in partial parameterization. So far I understand currying. But I cannot find any resources on how a function like this is implemented by the compiler in memory. Could I be pointed in the right direction, maybe keywords to search for or link...

Pointer to shift array C++

Hello, Im trying to shift my array left as efficiently as possible. Im using pointers now, and im having trouble assigning the values back into my array: void stack::rotate(int nRotations) { if ( count <= 1 ) return; int *intFrontPtr = &items[top+1].n; int *intBackPtr = &items[count-1].n; int temp = 0; for (int shift...

What is 'Form and Report Design' in Software Engineering?

What is 'Form and Report Design' in Software Engineering? ...

Fastest way to insert a word at the correct position in a dictionary

Currently, I'm simply inserting the word into the dictionary (ArrayList<String>) and then sorting the dictionary like so: dictionary.add(newWord); Collections.sort(dictionary, new Comparator<String>(){ public int compare(String s1, String s2) { return s1.compareToIgnoreCase(s2); } }); I'm trying to determine wh...

How to determine the FIRST set of E in this grammar ?

I wonder how to determine the FIRST set of E with grammar: E -> XYE | e X -> x Y -> y Can anyone give me some direction? ...

inheritance:understanding

suppose for example a program is to process complex numbers consisting of real and imaginary parts. in a complex number, the real and imaginary parts behave like real numbers so all of the operations (+,-,/,*,sqrt,sin,cos, etc) can be inherited form the class of objects called REAL instead of having to be written in code. Does the asse...

Prolog Find the longest list in a list of lists

I have a list of lists, and I need to find the longest one of them. If there are more than one with the same length it's the same which it returns. Thanks. ...

How to check which process initiated sys_open

I'm taking a course in operating systems and we work in Linux (Red hat 8.0). I'm trying to implement a file open,close tracker that will save for every process a history of files it opens and closes. I expected sys_open,close to also accept the process id and that I could use that to access the history of the process that initiated the c...

Finding the highest key

I'm just confused about why my code would not work, here's the question and the code I have so far (the test run says my answer is wrong). Given the dictionary d, find the largest key in the dictionary and associate the corresponding value with the variable val_of_max. For example, given the dictionary {5:3, 4:1, 12:2}, 2 would be asso...