homework

Java Class Design - Graphs

Hey there, I'm fairly new to Java, and I need some help figuring out a good class hierarchy and overall design for an assignment we've been given (i'm studying CS). The assignment is graph-theory related, so we were asked to create interfaces for 2 types of graphs, simple graphs and multi-graphs (which are allowed to have parallel edge...

nonrecursive mergesort in C++

I wrote the entire thing, but i get vague errors. I don't know what's wrong....ugh.Also, you may ask why non-recursive well my teacher has it that way for the test. void nonrec_mergesort(vector <int> & a, vector <int> & b, int s, int r) { int m = 1; while (m <= r) { int i = 0; while(s < (r-m)) { ...

Implementation of barrier in Java

How can a barrier be implemented with semaphores in Java. Will the following pseudo code work? How can it be written using java Semaphore class. N is the number of threads to be waited for at the barrier. EveryoneHasReachedBarrier is a conditional variable. Aquire(mutex) m = m + 1; if(m != N) { Release(mutex); Aquire(EveryoneH...

array of vehicles

is there anyone that can help me with java program I spent hour troubleshooting? I have no problem reading the file into a string array but I don't seem to know how to use switch or maybe if statement to store each line in an Array of Objects. Write an application with a main that reads a file (from the command line) and fills an ar...

opengl: how to keep objects in window when it's resized

I'm working a MS paint-like application on OpenGL using Bresenham's midpoint algorithm as homework. So far I can draw lines and ellipses. I lose them all when resizing the window. How can I keep them drawn? Full code: #include "GL/glut.h" #include <stdio.h> #include <math.h> int i; //int mainWindow, subWindow; int X1, Y1, X2, Y2; in...

Query to get ALL matches for a particular column

Suppose I have two tables Table1 and Table2 with the following data. Column1 Column2 Column3 AAA KKK 9 BBB LLL 7 CCC MMM 9 DDD MMM 5 EEE MMM 7 FFF NNN 9 GGG OOO 1 Column4 Column1 TTT DDD TTT BBB UUU EEE VVV BBB WWW AAA WWW BBB XX...

Mysql Stored Procedures - Returning Message

It's a bit silly asking homework questions here, however I'm genuinely stumped as to what this question is asking. Create a stored procedure to add results. The procedure should take four (4) parameters. These are; The student's name (first and last), the name of the apparatus and the score. When the data has been inserted,...

Having problems coding a char array to a string

I'm trying to use a string constructor to convert the 2d char array into a string. Having problems finding the proper constructor. I attempted using various constructors but nothing seems to work. ...

Setter and getter not working

This is my assignment about setter and getter and it is not working for some reason. Could anyone check what the problem is for me? Thank you. public class FlightTest { public static void main (String [] args) { String name; String number; String Orig; String Desti; Scanner scan = new Sc...

C# DateTime problem

Aries March 21 to April 20. Taurus April 21 to May 20. Gemini May 21 to June 21. I need to print the Astrological sign of a user by getting the user's birth month and the date as inputs.how can i get the date range??. EX: March 21 to April 20 ...

How do i configure Vitelty VOIP Provider?

I have created SIP Trunks for Incoming settings and Outgoing settings as mentioned below: **Outgoing settings** are authuser=miracletelxxx context=from-pstn canreinvite=yes dtmf=rfc2833 dtmfmode=rfc2833 fromdomain=in1.miracletel.com fromuser=miracletelxxx username=miracletelxxx host=in1.miracletel.com insecure=very ...

Physical Database Design using java code

Implement an Employee database file to store all employee information using Dynamic External Hashing (either Extendible or Linear) Ordered File Hints: Use any small hash function and simulate your buckets as files rather using block address, since this address is low level. Suppose that the bucket can contain only 3 records Be care...

Generate random sport game result c++

I was required to write a program that generate random results of 10 sport games where 10 countries are involved, and display the medal tally based on the results. I was able to generate the games' result but have no idea how to sum up the results (i.e. the number of different medals earned by each country). Below is part of my code to...

Physical Database Design using java code

Possible Duplicate: Physical Database Design using java code Write program code to access individual fields of Employee records under each of the circumstances. For each case, state the assumptions you make concerning pointers, separator characters, and so forth. Determine the type of information needed in the file header in o...

Algorithm to find common subsets

I have N number of sets Si of Numbers, each of a different size. Let m1, m2, ... mn be the sizes of respective sets (mi = | Si |), and M be the size of the largest set. I have to find common subsets that have at least two numbers in them. Example: Set Items 1 10,80,22 2 72, 10, 80, 26,50 3 80, 4 10, 22 5 22, 72, 10, 80, ...

the # of internal nodes

THis Q is in data structures that is: Write a recursive algorithm that will, given the root node of a tree, calculate the number of internal nodes of the tree? the internal nodes is root /\ internal nodes internal nodes / \ / \ leaf leaf leaf internal nodes...

Using List.nth on an 'a list list in SML

I'm trying to declare a function takelist : 'a list list -> int -> 'a list, so that calling takelist xs n will return the elements in spot number n in the lists from xs. takelist [[#"3", #"6"], [#"6", #"2"], [#"5", #"9"]] 1; should return [#"6", #"2", #"9"]. This is what I have: fun tagliste (x::xs) n = List.nth(x,n); I does half ...

Context-free grammar(CFG) & Recursive descent parser(RDP) for id:=expression

Write a Context-free grammar(CFG) that pass all assignment statements of the form id:=expression where expression is an arithmetic expression involving integers,real numbers,identifiers,operators like +,_,*,/,%,^ and parenthesis().use to construct Recursive descent parser(RDP) for the same. ...

Print columns with Awk or Cut?

I'm writing a script that will take a filename as an argument, find a word a specific word at the beginning of each line - the word ATOM, in this case - and print the values from specific columns. $FILE=*.pdb * if test $# -lt 1 then echo "usage: $0 Enter a .PDB filename" exit fi if test -r $FILE then grep ^ATOM $FILE | awk '{ print ...

C++ read file from .txt and holds the desired value in a new .txt using Xcode...

The text files are in this format : No. Time Source Destination Protocol Info 1 0.000000 192.168.1.77 203.253.16.41 DNS Standard query A ksn1.kaspersky-labs.com Frame 1: 83 bytes on wire (664 bits), 83 bytes captured (664 bits) Ethernet II, Src: Giga-Byt_58:d7:ce (00:1f...