This week's book giveaway is in the iOS forum.
We're giving away four copies of Classic Computer Science Problems in Swift and have David Kopec on-line!
See this thread for details.
Win a copy of Classic Computer Science Problems in Swift this week in the iOS forum!

Vineet Kakati

+ Follow
since May 03, 2010
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Vineet Kakati

When you create a Java object by calling its constructor, the object reference that is returned is called an instance. There is little difference between the two terms. The word instance is usually used when we talk about the process of object creation or instantiation, it is a single reference to an object.
8 years ago
Refer the following link to get difference between'==' and equals();
8 years ago
Yes my code works even if key is element at index 0.The function returns 0 in that case;
8 years ago
I didn't get you properly;

But my code works perfectly whether number of elements in array are odd or even(array is sorted in ascending order).
8 years ago
First of all your existing 'if' condition means that you are basically trying to compare whether spot1 and spot2 point to same object which they do not ,so they are displayed to be not equal;

Secondly if you want execute the println statement on basis of equality of radius,change your 'if' condition to

Also make variable radius non-static
8 years ago
you have put almost your entire code in main() which is not recommended.
main() should ideally contain only function calls to functions which actually do the tasks.

As for insertion,deletion etc.,I believe I suggested what I think is an efficient solution to your problem in my first post.

8 years ago
MARC stands for MAchine-Readable Cataloging.
LC numbers are used for cataloging in libraries.
Although they aren't related to java.

For a book to have cataloging details means a detail by which book can be grouped,for eg:books can be grouped by genre as fiction,comedy etc.

I would also recommend against making different classes for book according to genre.
Instead you can add an instance variable genre to class Book;

refer my earlier post for creating array of books;
8 years ago
The part of code mentioned in beginning is not really required;
also mid = (first+upto)/2;

consider the foll. code:-

I also don't see the point of having two seperate functions binary search and rbinarysearch;
8 years ago
create a class Node having instance variables data and p;
the variable data stores data.
the variable p is of type Node which points to another node;

create a linked list by creating objects of class node and link them together by using variable p for each node;
p for last node should be null;
8 years ago
make following change in function

8 years ago
I would suggest using a character array to enter characters one by one;
I would also suggest the use of functions toUpperCase() and toLowerCase for each entered character;
After entering ,the array should be printed;
Continue entering characters till entered character is not '.';

Refer the changes made to your code as shown below:-
8 years ago
As your instructor said create another variable for eg 'diff' that stores difference;

1:Find the absolute difference between density of each country and average density and store the difference in diff;

2:if diff is less than stored value of diff
then store the index of that country in another variable for eg 'index';

Repeat steps 1 & 2 for all countries in array.

At end 'index' will be the index of country in array having density nearest to average

8 years ago
To make program loop as per user input simply change your outermost 'do while' loop.

1:Put the 3 function calls printMatrix ,chooseSeat, printMatrix(1,13) inside 'do while' loop;

2:Then ask user if he wants to allot another seat.

Refer the code snippet below
8 years ago
simply write

immediately after

That should do the trick.
8 years ago
You are not giving a call to function initializeArray() anywhere;
call function initializeArray() in main before do while loop;

Also I noticed that your code works only once i.e after allotting 1 seat the program terminates.
I suppose you want to allot more than 1 seat;

I suggest taking user input to decide whether to break 'do while' loop or not.
8 years ago