Home Answers Viewqa JSP-Interview-Questions plz help me any one as fast as u can

 
 


saai
plz help me any one as fast as u can
3 Answer(s)      a year and 8 months ago
Posted in : JSP-Interview Questions

A thief Muthhooswamy planned to escape from **** jail. Muthhooswamy is basically a monkey man and he is able to jump across the wall. He practiced to cross a wall and he is able to jump 'X' meters, but because of slippery wall he fall 'Y' meters after each jump. To escape from jail he has to cross 'N' number of walls where height of each wall is given in an array. Write a program to find out the total number of jumps he will make to escape from the jail.

Input Specifications

Your program must read 4 arguments (climbUp, climbDown, noOfWalls,wallHeights[]) where

climbUp is the number of metres he can jump (1<=climbUp<=10^10) climbDown is the number of metres he slides down (1<=climbDown<=10^5) noOfWalls is the number of walls he needs to jump to escape (1<=noOfWalls<=10^5) wallHeights[] is a single dimensional array where the height of each wall is provided, the ith element is (1<=i<=1000)

Output Specifications

Your program should return total number of jumps to the output variable output1 provided

Examples

Sample Input 1: 10:1:1:{10} Here Muthooswamy can jump 10 metres height but slides down by 1 metre. He has 1 wall to jump and the height of the wall is 10 metres. Since he jumps 10 metres in the first attempt he cross the wall easily in the first attempt only.

Sample Output 1: 1

Sample Input 2: 5:1:2:{9,10} Here Muthooswamy can jump 5 metres height but slides down by 1 metre. He has 2 walls to jump and the height of each wall is 9 and 10 metres respectively.

While crossing the first wall, Muthooswamy takes 2 attempts because during the first attempt he jumps 5 metres but slides down by 1 metre since he didn't cross the wall. In the next attempt he jumps 5 more metres from that position and this time he doesn't slide because he crossed the wall in this attempt because 4+5=9 and 9 metres is the actual height of the wall.

Similarly while crossing the second wall, Muthooswamy takes 3 attempts because during his second attempt on this wall, he slides down by 1 metre since 4+5=9 and the height of the wall is 10 metres. During his third attempt, Muthooswamy was able to escape from ***

Sample Output 2: 5

View Answers

October 8, 2011 at 3:27 PM


import java.io.*; import java.util.Arrays;

public class UserMainCode { //Assume following return types while writing the code for this question. public static int output1;

public static void GetJumpCount(int climbUp,int climbDown,int noOfWalls,int[] wallHeights)
{
        while(noOfWalls>0){
            output1 = jumpAmount(output1, climbUp, wallHeights[--noOfWalls], climbDown);
        }
}   

private static int jumpAmount(int totalJump, int climbUp, int hight, int climbDown){
    if( hight <= climbUp){
        return ++totalJump;
    }
    else{
        hight = hight - (climbUp - climbDown);
        return jumpAmount(++totalJump, climbUp, hight, climbDown);
    }
}

public static void main(String[] args) {
    int a[] = new int[]{10,20};
    GetJumpCount(10,1,2,a);

    System.out.println(output1);
}

}


October 8, 2011 at 3:28 PM


public class UserMainCode { public static int output1;

public static void GetJumpCount(int climbUp,int climbDown,int noOfWalls,int[] wallHeights)
{
        while(noOfWalls>0)
            output1 = jumpAmount(climbUp, wallHeights[--noOfWalls], (climbUp - climbDown));
}   

private static int jumpAmount(int climbUp, int hight, int oneJump){
    if( hight <= climbUp)
        return ++output1;
    else{
        ++output1;
        return jumpAmount(climbUp, (hight-oneJump), oneJump);
    }
}

public static void main(String[] args) {
    int a[] = new int[]{10,20};
    GetJumpCount(10,1,2,a);

    System.out.println(output1);
}

}


October 8, 2011 at 3:28 PM


public class UserMainCode { public static int output1;

public static void GetJumpCount(int climbUp,int climbDown,int noOfWalls,int[] wallHeights)
{
        while(noOfWalls>0)
            output1 = jumpAmount(climbUp, wallHeights[--noOfWalls], (climbUp - climbDown));
}   

private static int jumpAmount(int climbUp, int hight, int oneJump){
    if( hight <= climbUp)
        return ++output1;
    else{
        ++output1;
        return jumpAmount(climbUp, (hight-oneJump), oneJump);
    }
}

public static void main(String[] args) {
    int a[] = new int[]{10,20};
    GetJumpCount(10,1,2,a);

    System.out.println(output1);
}

}









Related Pages:
plz help me any one as fast as u can
plz help me any one as fast as u can  A thief Muthhooswamy planned... is the number of metres he can jump (1<=climbUp<=10^10) climbDown... Sample Input 1: 10:1:1:{10} Here Muthooswamy can jump 10 metres height
Any one can help me? - Java Beginners
Any one can help me?  CAN any of u help me to do this java codes for the interface given below? thanku the user will be given jumbled words.... If the player is able to arrange all the words without any mistake, he/she can get
plz Help me - Java Beginners
plz Help me  Hi, I want learn struts,I dont have any idea about this plz help how can i make a framework.If u have any information then plz send my personal id plz tell me that whose software installed.and give me brief
Can u Look to the error plz - Java Beginners
Can u Look to the error plz  this is my code can u modify it plz and give me the result of it when u check it on eclipse or jcreator plz and i will be more thankfull if u do that :) , oh yeh one thing can you draw a flag
can u help me to get a calendar with color codes on days ???
can u help me to get a calendar with color codes on days ???  hi roseindia, Can you help me to get the code, I need a calendar with color codes.i,e....... NOTE:Its a calendar not a date-picker PLZ can you help me, its very urgent
any one help me in alfresco technology - Development process
any one help me in alfresco technology  i am sending some questions in alfresco,but no one is give the answer. i want webscript materials and JSON materials.please any body can u responding my questions.  Hi friend
please any one can help me to write a code for this question?
please any one can help me to write a code for this question?  1) Copy one file content to other? 2) Count the number of words in a file
please any one can help me to write a code for this question?
please any one can help me to write a code for this question?  Q 1) In a class first day 25 students are joined. After two days that total students will increased to 60. We can develop a program by using ArrayList concept
plz help me - Java Beginners
is true...but i very confuse that how it is not displayed admin page plz any one give me reponse my persinal given id  Hi ragni, i am sending...plz help me  Thanks deepak continue response..i face some problem i
could any one help me?
could any one help me?  I'm a student in the faculty of computer and information science we will make graduation project "taxi dispatcher" we need to use mobile "x6 nokia" in car and send the coordinate of car through gps which
can u plz try this program - Java Beginners
can u plz try this program  Write a small record management application for a school. Tasks will be Add Record, Edit Record, Delete Record, List...) No database should be used. All data must be stored in one or two files. Listing
need the answer vry urgently..plz help me...[plzzzzzzzz
... useing struts or servlet... in eclipse platform...can any one tell me the source......to panda.pragnya7@gmail.com/panda_pragnya@yahoo.com...plz plz...help....me..it can change my lyfe...need the answer vry urgently..plz help me...[plzzzzzzzz  the question
Help me quickly plz??
Help me quickly plz??  Can you help me to write code quickly this code is a java code take input as double and should use command line arguments and enhanced for statement then find the combine of the numbers plz help quickly
CAN U HELP ME TO CODE IN JSP FOR ONLINE VOTING SYSTEM
CAN U HELP ME TO CODE IN JSP FOR ONLINE VOTING SYSTEM  can u help me to code in jsp for online voting system
plz help me - Java Beginners
plz help me  Hi, I want to search all field from database using name, and display in text box, then data is update and delete. i want to search name using alphabets a-z, plz reply fast. plz help me this is very urgent
interview question plz help me and thers
interview question plz help me and thers  A college is good... "M.Tech" is one of the courses offered, it must also offer "B.Tech" and "MCA" courses. 5.If "MBBS" is one of the courses, it must not offer a "B.Tech" Course
plz help me - Java Beginners
plz help me  Deepak I can write a sessioon code plz help me admin_home.jsp page is display but data is not disply plz help me what is wrong
hi , i cant make this programmer , can any one help me to make it pls - Java Beginners
hi , i cant make this programmer , can any one help me to make it pls  ... ? -Update record(s)? -Delete record(s)? -Make one copy of a specific text file... file and by calling all the implemented methods. the user can input the name
plz help me - Java Interview Questions
plz help me  1)Rewrite the method in exercise 10 such that it use...; if the array or sorted , the high-speed binary search can be used as follow... consists of one element that is not equal to the search value , i.e. the search
Can any one please help me in this ,,,,,,, need java code for this ,,,,please anyone
Can any one please help me in this ,,,,,,, need java code for this ,,,,please anyone  The Airport Valet Parking Company (AVP) is a company which provides a convenient medium cost parking solution to users of a local airport. Key
fast Reply - Java Beginners
fast Reply  Hi Friend I want to passing value one page to another page without using session varible....please help me write the code and send me   Hi friend, For solving the problem visit to : http
plz help me - Java Beginners
plz help me  deepak hw can i create a data grid in jsp and also how can i connect to the data base plz help me  to create data grid in jsp use html tables with borders. to connect to data base use scriptlets. ex
can u plz explain the http request methods - JSP-Servlet
can u plz explain the http request methods  can u plz explain http... duplicate entries in the MySQL database we can follow one of these following approach... we can execute following query: Query CREATE TABLE backup_table AS SELECT
help me
help me... class.Several lines of customer should be displayed. you can add a new customer... , one checked out , the customer is removed from the line. in addition, i want
plz help me!!!!!!!! - JSP-Servlet
plz help me!!!!!!!!  i`ve set the environment varaibles for tomcat... there are compilation errors.. plz do help me.   make sure that you did...) /AddStudent.java /lib(If any jar files required) /web.xml
actually i want to knw how to include an google page inside a tab(suppose in 2nd tab).can any one help me....
how to include an google page inside a tab(suppose in 2nd tab).can any one help me....  actually i want to knw how to include an google page inside a tab(suppose in 2nd tab).can any one help me
Gui plz help
Gui plz help   Create a Java application that would allow a person... and put two buttons one button makes two random numbers and the other button tells if u got it right or wrong and also i gave them some coding but i can't make
help me plz:-Merge multiple jasper files into Single one
help me plz:-Merge multiple jasper files into Single one  how to Merge multiple jasper files into Single one word doc
can u plz help out how to attach file directly & send to a particular mail id
can u plz help out how to attach file directly & send to a particular mail id  i am building a project online LEAVE MANAGEMENT SYSTEM to our coll mini project so if a faculty write all details abt leave & shd send to HOD
Can someone help me with this?
Can someone help me with this?  I have this project and i dont know how to do it. Can someone help me? please? Write a java class named "PAMA..., Multiply, Divide) Help me please! Thanks in advance!   import
code and specification u asked - Java Beginners
code and specification u asked  you asked me to send the requirements... for any kind of image and text handling, whether local or on the web. It can asset in any application that can impress the heck out of people. Just as you?d
Intranet Website creation - plz help me
Intranet Website creation - plz help me   hi.. I have assign with the intranet website creation work..right from scratch to end..And honestly I know nothing about it.My domain is totally different .. can anybody pls help me
Can anybody help me with this simple MySql code
cad 2013-03-16 18:26:31 can any one help me with the query because i want to select al of them but it should select for me only 1 duplicate countryid...Can anybody help me with this simple MySql code  select c.countryid
help plz - Java Interview Questions
, if the input string is abcd, the output is : edcba plz plz plz plz plz help...help plz  1 )write a program that does the following : a. prompts.... the program than outputs the digits of the number, one digit per line
plz help me for this question
plz help me for this question  Apply simplex procedure to solve the L.P.P. maximize z = 3x1 + 4x2 subject to 5x1 + 4x2 â?¤ 200; 3x1 + 5x2 â?¤ 150; 5x1 + 4x2 â?¥ 100; 8x1 + 4x2 â?­â?¥ 80, x1 â?¥ 0, x2 â?¥ 0
plz Help me find the correct programs answers
plz Help me find the correct programs answers   Create a washing... INDICA" and "TATA NANO" respectively. Plz mail me your answers... to the program so as to accept any type of numeric values and returns the results
java, plz help me in doing this - Java Beginners
java, plz help me in doing this  # Write a small record management... Limit). No database should be used. All data must be stored in one or two files.....giving me the error of NoClassDefFoundError
Plz Help Me
Plz Help Me  Write a program for traffic light tool to manage time giving between Main-Street and sub-Street. firstly, give green light for 40... traffic light on the frame. We have used java swing. It may help you. import
plz explain me the output of program - Java Beginners
plz explain me the output of program  Hi friends, can u please explain me the output of below program with proper explanation of each and every line...,c.Through 'this' keyword,you can refer to any member of the current object from within
CAN ANYONE SOLVE THIS FOR ME. URGENT HELP NEEDED. PLEASE HELP
CAN ANYONE SOLVE THIS FOR ME. URGENT HELP NEEDED. PLEASE HELP   ... have one parameter, a student name. There should be an accessor... methods: one for setting the coursework mark and one for setting the exam
CAN ANYONE SOLVE THIS FOR ME. URGENT HELP NEEDED. PLEASE HELP
CAN ANYONE SOLVE THIS FOR ME. URGENT HELP NEEDED. PLEASE HELP   Write... constructor should have one parameter, a student name. There should be an accessor method for returning the student name. There should be two mutator methods: one
displaying List of records from database in a jsp using ajax, onclick it should display the results ?? its urgent can u help me
displaying List of records from database in a jsp using ajax, onclick it should display the results ?? its urgent can u help me   displaying List... ?? its urgent can u help me
plz help me find a program
plz help me find a program  plz help..i want a source code in jsp for order processing
can any one explain this
can any one explain this  class Clidder { private final void flipper() { System.out.println("Clidder"); } } public class Ex3 extends Clidder { public final void flipper() { System.out.println
can any one give the frogort password code using jsp,
can any one give the frogort password code using jsp,  plz give the code for frogot password
very urgent : Iam unable to code this program plz help me - RMI
very urgent : Iam unable to code this program plz help me  Write a Multi-user chat server and client.  Hi friend, Chat server... must be connected with the server after that your message can broadcast to each
population problem plz help me befor 16 March 2011 !!
population problem plz help me befor 16 March 2011 !!  the Q is : How can i count how many years it will take for the population of a town to go over 30.000 .. consider that it Increases 10% every year ?? And this is my code &
sir i,have a assignment for these question plz help me sir - JavaMail
sir i,have a assignment for these question plz help me sir   1.Design a Java interface for ADT Stack. Develop two different classes that implement this interface, one using array and the other using linked-list. Provide
plz help me today plz plz - Java Interview Questions
plz help me today plz plz  2.) Suppose list is an array of six elements of type int. What is stored in list after the following java code executes? . for (i = 0; i < 5; i++) { list[i] = 2 * i + 5
help me in these - Java Interview Questions
help me in these  hello every body i have some question if you cam plz answer me it is important to me and these are the questions : 1)Write... and then prints out the two words on one line such that the two words are separated

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.