homework

Android: I cant seem to add to my database

So basically my app starts out with a TabView, then through the options menu the user selects to add a game to the database. This opens the InputGame class, which accepts a few values, and then it should put them into a database when the user clicks "Submit". It will also go back to the original home view. The app goes back the the home...

algorithm for DFS

Can anybody tell me the algorithm for depth first search (DFS)? I need to write the code for DFS in python. ...

help in executing the code

My code: nodes = [] stack = util.Stack() child = [] currNode = problem.getStartState() stack.push(currNode) while not stack.isEmpty(): nodes = stack.pop() if problem.isGoalState(nodes): return nodes else: child = problem.getSuccessors(nodes) ...

comparing strings (from other indices rather than 0)

How can one compare a string from the middle (or some other point but not the start) to another string? like i have a string str1[]="I am genius"; now if i want to find a word in it how should i compare it with the word? for example the word is am. Here is what i did.Its a bit stupid but works perfectly :D #include<stdio.h> #include<...

TreeSet or TreeMap - as per instruction

Hello, In the instructions I have been asked to "declare a interface type to hold a map with sets of characters as its keys, and with sorted sets of strings as values". All this time I have been using TreeSets. Now I am not sure, I am now thinking of using TreeMap. Code below is demo TreeMap I have used. Firstly is it acceptable to use...

calculate min and max functions

I am a student this is my LAST homework assignment : ) /* **(4.9) Calculate the minimum salary for exempt employees **and the maximum salary for non-exempt employees. */ I can only use one select statement... or without running two separate queries I have 2 tables... Job_title (Job_title varchar (50) PRIMARY KEY, EEO_1_Classificatio...

C++ CppUnitTest (CPPUNIT_ASSERT_EQUAL)

I'm trying to do some CppUnit testing on my program using Ubuntu NetBeans but I keep encountering similar errors (invalid use of void expression). I'm not sure what went wrong. Any help will be greatly appreciated. The error goes like this: g++ -c -O2 -I/usr/include/cppunit -MMD -MP -MF build/Release/GNU-Linux-x86/AssignmentTest.o.d...

String Selection Sort C++

How would I modify a selectionSort function to search an array of strings? void selectionSort (int array[], int size) { int startScan, min Index, minValue; for (startScan = 0; startScan<(size-1); startScan++) { minIndex=startScan; minValue=array[startScan]; for(int index = startScan + 1;index<size;ind...

Can you solve this problem?

Hy guys there is a 2 int variable. can u swap those int variables with out using any if conditions as well as without any casting.and u cannot use any more variables. ie : int a=10; int b= 5; always a>b; the answer should be a=5;b=10; ...

How to insert, update, delete from remote database from within an iphone app

I am making an app for my msc project for which I need to connect to a remote mysql database and need to do insert, update and delete from my app. What is the basic code for that? I'm totally new in this platform.... ...

C# updating record in text file

I am working on my uni project on C#. It requires me to create a student management system in C# console. I have to use text file for saving data. I can add data and retrieve data in text file but unable to update any student record. My question is how I can update specific student record in text file? For example my program will ask us...

STL, reducing an array, c++

For a hw assignment, we are to code a reduce routine that looks like: int reduce(long array[], int size) //Where array is the array to reduce, and size is the size of the array. Using STL. My initial thoughts were to create a set, put all items in the set with a comparison, but then I realized that the set I would create would never...

misunderstoold on TreeSet - my mistake

Hello, Well all the questions I have been asking regarding TreeSet, I have wasted your valuable time. I am really sorry because I believe I mis-understood the question. It doesn't help when you got no one to talk to about this assignment. The real question was related to anagram assignment. In the first question it ask "To the Anagram c...

implement stack in c++

#include <iostream> using namespace std; #define max 10 class stack{ private: int arr[max]; int top; public: stack(){ top=-1;//empty initialy stack } void push(int i){ top++; if (top<max){ arr[top]=i; } else{ cout<<"stack full"<<endl; ...

Programming exercise ?

I got this exercise, is not a homework, I just trying to solve: We manage a farm with horses that have to work on the field. A horse has a name, a maximum amount of working hours per week, the amount of hours actually worked and a field to indicate if she is lazy or hard-working. All the attributes ...

Summing all numbers in a matrix

I just need what to do to be simplified. But if you write the source code I still want to know how and what u did explained. Write a function that sums all the integers in a matrix of integers using the following header: const int SIZE = 4; double sumMatrix (const double m [] [SIZE] , int rowSize, int columnSize) ; Write a test pro...

C++ CppUnit Test (CPPUNIT_ASSERT)

I'm trying to do up a screen scraping assignment. My cpp works, but I don't know how to integrate my unit testing. I tried to do a bool check unit test for the file validity but it's giving me this error: error: cannot call member function 'bool ScreenScrape::getFile()' without object screenscrape.cpp: #include "screenscrape.h" usin...

Implementing Binary Search

import java.io.*; import java.lang.Integer; class sort { public void find(int val,int a[],int n) { int mid=n/2; System.out.println("the mid value is:"+a[mid]); if (a[mid]==val) { System.out.println("found "+a[mid]+" in position "+ mid); } else if(a[mid] else if(a[mid]>v...

Are objects cleaned up when references to them are nulled?

public class App1 { public static void main(String[] args) { Point point_1 = new Point(5,5); Point point_2 = new Point(7,8); Circle circle_1 = new Circle(point_2, 10); point_1 = null; point_2 = null; } } How many object references exist after this code has executed? Why? ...

Array backtracking

Hi, There is an array of numbers, the number on each cell display how many setps does you need to go (left or right), for exmpple int[2]=4 that means that you have to go 4 steps or to int [-2] or to int[6] you have to return true if you went trough all the cell and did not went "out" of the array and false if not. Thanks a lot ...