homework

How do I find the elements of an array in C++ which sum to a value greater than or equal to a specific number?

I've written a loop in C++ to give me 6 random numbers and store them in an array. What I would like to do is to sum the elements of the array until I get a value larger than a number, "x", but I would like to do this without necessarily adding all the elements. The objective is to find the first elements which sum to the value of x. ...

Lost update problem in Concurrency control

I have two transactions T and U which are executed simultaneously in a DB. How does one provide an example of the lost update problem? We can assume that we have three accounts A,B,C and they each have £100,£200 and £300 respectively. ...

XML Schema testing a value and applying extra restrictions

Hello all! I have the following case: All boats have a boat type like shark , yatch and so on. I need to register which type of boat name and also how many feet the boat is, but this is where the problem arises. If the user types in a shark I need to validate that its between 15-30 feet, if he type in a yatch it needs to be between 30-...

How to implement Unix ls -l command in C?

Hi, I am implementing unix ls command in c with all option.But i am not getting any idea about ls -l command. please can some body give me direction of this or give one sample program for it. Thanks ...

Designing interface between application and GUI

For homework, I need to build a small java application.The main goal is to learn how to interact with XML. But a second goal is to learn how to build such an application. I have quite some experience on programming, but little experience in designing programs. I've read about designpatterns and designprinciples like Solid and TDD. But ...

what could be wrong with: char* param= new char[200];

Hi, I'm writing a program in C++ and for some reason I'm getting a segmentation error at the following line: char* param= new char[200]; I've tried different variations and even tried putting before it int* param= new int;//for no reason and the same error occurs. What might I have done to cause this problem? What could possibly ...

Unity and NHibernate

I am looking for the best way to configure Microsoft.Practices.Unity.IUnityContainer to manage the lifetime of an nHibernate ISessionFactory for an asp.net application. I would also like unity to inject my IDataLayer implementation which takes an instance of NHibernate.ISession by calling GetCurrentSession on its managed ISessionFactory....

Java polymorphism confusion

The question below is from Java SCJP5 book by Kathy Sierra and Bert Bates. Given a method declared as: public static <E extends Number> List<E> process(List<E> nums) A programmer wants to use the method like this: // INSERT DECLARATIONS HERE output = process(input); Which pair of declarations could be placed at // INSERT DECLARATI...

Problems with the waterfall model

I'm going to take an HCI exam tomorrow and a question on one of the past papers has really got me thinking, me and a few others are torn between A and C, what do you think? Q 25 - the waterfall technique is recognised as having several problems for the development of effective interactive systems. Which of the following is not one of th...

How do I bounce a point off of a line?

I'm working on writing a Pong game for my graphics class final project (I choose to write this, I wasn't assigned Pong) and I've run across a problem that wasn't addressed in either the book or the class. I'm trying to figure out how to bounce a point off of a line. The best method I can figure out to do this with is Calculate the ...

busy wait threads in java

Hello, I have an assignment with threads and I cant have the threads go into busy wait state. How do I know if a thread is in blocking state or in busy wait? Is there a command that checks it? In the program I have 2 matrices and I need to transform them. So I have a transform thread and the code is as follows: transformThread transfo...

MC68000 question: Layout of data in RAM

i m taking exam in 8 hrs...plese there are somethings i need to make sure that i uderstand properly before my MC68000 exam. question--- Write the following values in the memory lacations below, as the microprocessor would store them as bits or hex starting at address $8000 A 2AC543 ---- for this one do i have to add two 00 in the fro...

MC68000 question: Result of a loop

dose anyone have clue how to work on this ::::: Given the the following piece of a code, write the corresponding bit storage (in hex) at the memory location starting at $8000 Source line School MOVEM.L D6/A3-A6,-(SP) ADD.W D2,D BVS School ...

Curve fitting implementation using least square method in C++

I am trying to write C++ function perform curve fitting implementation using least square method. Input parameters of this function are x and y 1D array and n. And this function finds the coefficients of a polynomial p(x) of degree n that fits the data, p(x(i)) to y(i), in a least squares sense. Therefore, function will return coeffic...

What project management methodology to use to develop new software internally?

As part of my assignment I have to answer this question: The Sales Department has decided to develop new software internally. They will thus need to manage the IT project formally. Briefly describe two suitable project management methodologies models that could be used. I'm quite confused by the amount of methodologies. I Tho...

c++, sort a struct by last then first name

I have the algorithm for sort by last name, but I am having trouble figuring out how to sort by last name, then if two people have the same last name, sort by their first name. void sortLastName(FRIEND friends[ARRAY_MAX], int& count) { FRIEND temp; for(int i = 0; i < count - 1; i++) { for (int j = i + 1; j < count; j++) {...

How to write a simple class in C++?

I have been reading a lot of tutorials on C++ class but they miss something that other tutorials include so. Can some one please show me how to write and use a very simple C++ class that uses visibility, methods and a simple constructor and destructor. ...

Passing a **Class as an argument

Hi, I'm trying to declare a method in main.h like this: void buildGraph(int gNum, Graph** gArray); Where Graph is a class and I'm trying to pass a pointer to an array of pointers to Graph objects. I get the error message: "Graph has not been declared". Even though I have #include "graph.h" at the top of the page and I've been using ...

immediate exit while loop c++

How do I exit a while loop immediately without going to the end of the block? e.g. while(choice!=99) { cin>>choice; if (choice==99) //exit here and don't get additional input cin>>gNum; } any ideas? ...

simple implementation of queue

I have the following queue class (taken from wordpress): #include<iostream.h> class Queue { private: int data; Queue*next; public: void Enque(int); int Deque(); }*head,*tail; void Queue::enque(int data) { Queue *temp; temp=new Queue; temp->data=data; temp->next=NULL; if(heads==NULL) heads=temp; else tail->next=temp; tail=tem...