homework

Central/middle letter of a string.(methods)

Hi, I need to solve the following question which i can't get to work by myself(newbie^^)..: Ok, the question: Create a method which will print the central letter of a string (given as a parameter). I need to use the property lenght to determine the lenght. So for example the string: Books. the middle/central letter is o. Hope its a b...

Binary Tree in C - Troubles

typedef struct node { struct node *leftChild, *rightChild; int value; } bst; void insert(bst* b, int i) { b=malloc(sizeof(b)); b->value=i; b->leftChild = NULL; b->rightChild = NULL; printf("[%i]",b->value); return; } main() { bst* b...

I am trying to rearrange sections of a picture in matlab

here is the assignment: Open humpty_mixed.gif (2D image) and do what all of the king’s horses and men could not do – put humpty back together again. The image is 600x412 and split evenly along the row and columns. (Note: We may use the imread(), imshow(), and imwrite() commands here.) the picture is sectioned off in 4 rows and 4 colum...

Rewriting a program without using goto statements

I had to program a similar problem using goto statements. Now we are asked to rewrite our code without using goto statement. I don't know how to begin doing this program. I paste in the previous program code using the goto. // Eight Queens problem using one dimesional array and goto statement #include "stdafx.h" #include <iostream>...

Can I use a text file as my database in ROR?

I would like to use a delimited text file (xml/csv etc) as a replacement for a database within Ruby on Rails. Solutions? (This is a class project requirement, I would much rather use a database if I had the choice.) I'm fine serializing the data and sending it to the text file myself. ...

[Java] Question on how to refer to two specific objects in a method

So basically, we create four lines. One is created by giving a point (x,y) and the slope, the second is created by giving two points (x1, y1) and (x2,y2), the third is created as an equation in slope intercept form y=mx+b, and the fourth is given as an equation x=a with the line being vertical. To do that, we create four constructors. T...

how to bubble sort through a text file in java

How do I properly bubble sort through a text file by assigning the values to an array. In the code below I tried to assign the values from the text file to a string while there is still something to fetch. Then I used a for loop to assign the one that I have fetch to the array. Then tried to use the bubble sort to hopefully sort the numb...

Use of increments little prob.

Hi i have a problem with this program. Its not too complex, but frustrating. Here is the question......Write a complete c++ program to find the sum of first 5 odd numbers using while loop. Make sure to write an output statement to show the sum. Hint: Variable sum needs to be initialized to 0. Here is what I have so far #include <iostr...

Finding the longest down sequence in a Java array

Given this array int [] myArray = {5,-11,2,3,14,5,-14,2}; I must be able to return 3 because the longest down sequence is 14,5,-14. What's the fastest way to do this? PS: Down sequence is a series of non-increasing numbers. ...

C# Homework. I am looking for an explanation of what is going on.

Forgive me for asking what some might think are stupid questions. I am trying to read the code below and make sense out of it. Why is novel.title used in the main. I understand where I get the title from but why does novel.title used. The other one is what is holding the title information that was entered by the user. Same questions wit...

Urgent::java program to count 1 to 1000 number using 10 threads?

I need the Java Code to print the 1 to 1000 number using 10 threads? The code should be performance oriented. ...

Confusion about the output..

#include<stdio.h> int main(void) { int i=1,j=-1; if((printf("%d",i))<(printf("%d",j))) printf("%d",i); else printf("%d",j); return 0; } As printf() returns the number of characters successfully printed, the condition will be if(1<1) which is false but the if part is executed and the output is 1 -1 1. W...

Sum of the maximum downsequence number in an array.

Given this array int [] myArray = {5,-11,2,3,14,5,-14,2}; You are to find the maximum sum of the values in any downsequence in an unsorted array of integers. If the array is of length zero then maxSeqValue must return Integer.MIN_VALUE. You should print the number, 19 because the downsequence with the maximum sum is 14,5. Downsequenc...

getting a variable from a public scope to connect database

<?php $settings['hostname'] = '127.0.0.1'; $settings['username'] = 'root'; $settings['password'] = 'root'; $settings['database'] = 'band'; $settings['dbdriver'] = 'mysql'; /** * DATABASE */ class database { protected $settings; function __construct() { } function connect() { $this->start = new PDO( $this->settings['dbd...

i need the squareroot of "c" pls help how can i do it.

System.out.println("find the value of c if:"); Scanner kbreader=new Scanner(System.in); System.out.print("a="+" "); double a=kbreader.nextDouble(); System.out.print("b=" + " "); double b=kbreader.nextDouble(); System.out.print("c=" + " " ); System.out.print((a*a)+(b*b)); ...

Convert javascript array handling to jQuery

Hi everyone I'm doing a javascript assignment and have just learned that I can do it in jQuery if I wish, rather than vanilla javascript. I thought I'd give it a go to see what it's like. This is the contents of my javascript function: rowsArray = $("#Table1 tr"); for (i=0;i<rowsArray.length;i++){ numSeatsInRow = rowsArray[i]...

Create a vector of pointers to abstract objects

I'm sure there's a better way to do this. I'm trying to create a class HashTable that is given a size at instantiation, so it can't be given a size at design time, so I can't use an array as my internal representation of the table, as far as I know. So here's what I'm trying to do: #include <vector> #include <iostream> #include "Nodes...

Bit Level Manipulation & Arithmetic Functions (In C)

Hey everybody. I am learning bit wise operation and arithmetic operations in C but I am a bit confused about some of it. I am working through some of the review questions in my book but the book only has answers for the odd number questions so I would like to pose some questions for you guys so I can tell if I am on the right track. Than...

How to make an ArrayList

I have a homework assignemnt that I have been working with for the past few days and I just keep on going circles and circles thinking that I got the codes right but something wrong always comes up. These are the requirments In assignment 2, you will use the modified solution of the assignment 1. In the current version, the database is...

In C how do you access a variable in a struct that's in a pointer array?

typedef struct { employeeT *employees; int nEmployees; } *payrollT; typedef struct { string name; } *employeeT; I need to do this without accessing it as an array: employeeT e = payroll.employees[i]; but this gives me an error(expected identifier before '(' token) : employeeT e = payroll.(*(employee+i)); before struc...