GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  J2EE  >  Core Java
Go To First  |  Previous Question  |  Next Question 
 Core Java  |  Question 120 of 502    Print  
write classes/methods to calculate the total
length of a set of lines given the start and end points taking into account overlapping.
E.g.
Line 1
start: -1.4, end: 3.2

Line 2
start: 2.9, end: 4.1
etc..

Total length would be:
line 1 length = 4.6
line 2 length =1.2,
but as line 2 overlaps line 1 by 0.3, therefore length of set is 5.5(rather than 5.8).

Please see if you can think of good solution!


  
Total Answers and Comments: 2 Last Update: November 28, 2007     Asked by: sayfur79 
  
 Sponsored Links

 
 Best Rated Answer
Submitted by: saikumar
 
This is great site java devlopers

Above answer was rated as good by the following members:
talktoatish, sandeep_14185
November 28, 2005 20:00:34   #1  
saikumar        

RE: write classes/methods to calculate the total...
This is great site java devlopers
 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    
November 28, 2007 17:07:19   #2  
aarbee Member Since: November 2007   Contribution: 3    

RE: write classes/methods to calculate the totallength of a set of lines given the start and end points taking into account overlapping.E.g.Line 1 start: -1.4, end: 3.2 Line 2start: 2.9, end: 4.1etc..Total length would be:line 1 length = 4.6 line 2 length
Substract the least of start from max of end. Don't need to do any complex calc.
 
Is this answer useful? Yes | NoAnswer is useful 1   Answer is not useful 0Overall Rating: +1    

 Related Questions

Can we declare multiple main() methods in multiple classes.ie can we have each main method in its class in our program?

Latest Answer : let us analyze this in real world OO model:Can a puppy(small dog) extends Cow and Dog? It should be only puppy extends Dog, not both. Puppy(small dog) can't have charectrestics of Cow and Dog ...
Read Answers (5) | Asked by : Naresh

give me answer 
Latest Answer : public class CSingleton {   private static CSingleton inst= null;private static int count=0;protected CSingleton() {                        ...
Read Answers (5) | Asked by : chandu

give me answer 
Latest Answer : We can use clone() method to create another instance of a singleton class.Example:SingletonObjectClass obj = SingletonObjectClass.createSingletonObject();SingletonObjectClass clone = (SingletonObjectClass) obj.clone();java.lang.Object class has a clone ...
Read Answers (1) | Asked by : chandu

Latest Answer : I think this is the one of the way to return two refference fro one ObjectClassA extends from ClassBthenin ClassBwe can write like thisClassB b=new ClassB();this is one andClassA a= new ClassB();this is twoof course at complie time it seems to be same ...
Read Answers (1) | Asked by : chandu

It is a saying that static methods in JAVA programs should be minimised. What is the reason for this? any problems arise or there is any performance measures to be looked into it.
Read Answers (3) | Asked by : Beena

br />1.what is oracle.2.what is major differenece oracle8i and oracle9i.4.tell me some thing ur self.5.please tell me about oops.6.what is single inheritance.7.what is multiple inheritance.8.can java support 
Latest Answer : 8.can java support multiple inheritance.java support multiple inheritance for interfaces not fro classes25.what is difference between procedure and functions.function returns only one value where as procedure returns more than one value ...
Read Answers (11) | Asked by : rajjava

Latest Answer : Abstract Class: There are two ways to create abstract class, one is by mentioning abstract key before the class declaration, and second one is by mentioning abstract key before the method declaration we can make that class as abstract class.eg:public ...
Read Answers (4) | Asked by : Beena
Tags : Abstract

Latest Answer : Bez byte code genrated and understtod same on each compiler ...
Read Answers (4) | Asked by : Beena

I need some more information about interface. For Example there is no any functionality inside the method which is declared in any interface. Then why i want to implement that interface to my class. 2. Statement is an interface. When i say stmt.executeQuery(). I am getting the records in my ResultSet. How it is possible?.. since there is no functionality insid the methods which is declared in Statement Interface. What is happning here?
An idea 


 Sponsored Links

 
Related Articles

Service Oriented Java Business Integration Review

Service Oriented Java Business Integration Review Introduction If you ve read through the texts which give you an introduction to SOA or Web Services you will often find them to be quite frustrating and the reason for this is because they spend too much time referencing business processes which are
 

ODP.NET - Fundamental ODP.NET Classes to Retrieve Data

ODP NET Fundamental ODP NET Classes to Retrieve Data To retrieve data from an Oracle database using ODP NET we need to work with a few of the ODP NET classes At this point we will discuss the most fundamental classes available in ODP NET for retrieving data mosgoogle The following is the list of fun
 

Microsoft AJAX Library - C# and JavaScript Classes

C and JavaScript Classes For the purpose of demonstrating a few more OOP related concepts we ll use another class Our new class is named Table and it has two public fields rows columns and one method getCellCount The getCellCount method should return the number of rows multiplied by the number of co
 

Microsoft AJAX Library - JavaScript Classes

JavaScript Classes Not only can JavaScript functions contain other functions but they can also be instantiated This makes JavaScript functions a good candidate for implementing the concept of a class from traditional object oriented programming This is very helpful feature indeed because JavaScript
 

A Good Attitude Leads to Success

A Good Attitude Leads to Success What is the secret to Success There are numerous secrets” out there on attaining success The vast majority of these so called secrets all have one thing in common Attitude mosgoogle center The reasons why people choose not to apply this main secret of s
 

ERP: More than a Sales Solution

ERP More than a Sales Solution In this globalized world ERP is no longer just a competitive advantage It is an important requirement for every enterprise Many specialists argue that ERP is completely necessary to deal with businesses in every corner of the market This is because ERP does not work in
 

C++ Storage Classes

C Storage Classes In this C tutorial you will learn about storage classes types of storage class variables Automatic External and Static explained with examples mosgoogle center Storage classes In the context of scope of variables in functions exists the important concept of storage class What is St
 

Java and Client Server Models

Java and Client Server Models The Role of Client Servers on the Web Client server models provide the essential mechanisms for working with the Internet In fact most of the World Wide Web is built according to this paradigm In client server models the web browsers run by millions of users are the cli
 

C++ Objects and Classes

C Objects and Classes An Overview about Objects and Classes In object oriented programming language C the data and functions procedures to manipulate the data are bundled together as a self contained unit called an object A class is an extended concept similar to that of structure in C programming l
 

On-Line Transaction Processing

On-Line Transaction Processing On-Line Transaction Processing is a processing that supports the daily business operations. Also know as operational processing and OLTP.  An OLTP is a database which must typically allow the real-time processing of SQL transactions to support traditional reta
 

About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape