How do you get a method from recursing infinitely

Assignment Help Basic Computer Science
Reference no: EM131032465

How do you get a method from recursing infinitely?  In the example below, It asks for a double value, then another.  The first value must be less than the second value.  If not, it will ask you to enter a double that is less than the second one.  After that, it will allow you to enter 2 more doubles but the problem is it keeps going and won't stop.  So what do I need to put in there to make it stop afterwards?

Example:

public static void getOperands() {

Scanner scnr = new Scanner(System.in);
    System.out.println("Enter a double value");
    double operand1 = scnr.nextDouble();

    System.out.println("Enter another double value");
    double operand2 = scnr.nextDouble();

if(operand1 < operand2) {

calcPercentage(operand1, operand2);

}
else
    System.out.println("Enter a double that is less than the second double");
    getOperands();
}

Reference no: EM131032465

Questions Cloud

Age of the mother-marital status of mother : Problem: As part of a data base on new births at a hospital some variables recorded are the age of the mother, marital status of the mother (single, married, divorced, other), weight of the baby, and sex of the baby. Of these variables
What are busses and ports plx : What are busses and ports plx give me some to the point answer for this sir plx
Quantitative analysis for the two companies on profitability : A highlighting of the most important changes within these ratios and an identification of the reasons for these changes. A comparison of the quantitative analysis for the two companies on Profitability, Asset efficiency, Liquidity, Capital structu..
Compare the tax advantages of debt versus equity capital : Imagine that you are a Certified Public Accountant (CPA) with a new client who needs an opinion on the most advantageous capital structure of a new corporation.
How do you get a method from recursing infinitely : How do you get a method from recursing infinitely?  In the example below, It asks for a double value, then another.  The first value must be less than the second value.  If not, it will ask you to enter a double that is less than the second one.  Aft..
Four values aligned to the standards of conduct in pmp : What are the four values aligned to the standards of conduct in pmp? Choose ONE of the values and provide your reasons as to why this value is essential in project voice based email for blind people.
Write paper on the mexican and american war on drugs : Write paper on the Mexican and American War on Drugs - you need to write 800 words.
Physical therapy : Looking for Microsoft Office 2013: Advanced Capstone Project 2 BJM Physical Therapy. Willing to pay whatever is needed for it completed. Need before Sunday 4/24. Anything helps, greatly appreciated.
Validate user information : Create 2 web pages that does the following: 1) Page 1: HTML Page that contains a form that collect information from user and pass it on to the next page. a) You need to validate user information (String, number, email,..)

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Describe areas where you see disagreement between authors

Include any information you believe adds to the material in the text. Describe any areas where you see disagreement between the two authors.

  Distribute music on the internet.

an architecture for a system (such as iTunes) that is used to sell and distribute music on the Internet. What architectural patterns did you use as the basis for this architecture? Why are these patterns appropriate?

  Function definitions

C++ problem.   Hi there,  I am having problems figuring out my lnk2019 error. below is my code.  I am using visual studio 2012 premium. // Week 5 Assignment-1// Description: correct 8 errors

  Does managerial behavior warrant reporting

Many employees are aware of reporting procedures for ethics violations, but which of the managerial behaviors would be worthy of reporting as an ethics violation? At what point does managerial behavior warrant reporting?

  Write java program that allows the user to enter wall space

Write a Java program (from scratch) that allows the user to enter the wall space to be painted and the price of paint per gallon.

  Deliver software to a schedule

You are asked by your manager to deliver software to a schedule that you know can only be met by asking your project team to work unpaid overtime.

  How does a database system generate xml document

1. How does a database system generate XML document from database data? What is the importance of the order of tables in a SQL statement that uses FOR XML? (at least 200 words)

  Creating and configuring virtual machine settings

Assignment Preparation: Activities include completing the Microsoft® Official Academic Course (MOAC) Labs, completing the Microsoft® Official Academic Course (MOAC) Lab Challenges, independent student reading, and research.• Complete MOAC Lab 7, "Cre..

  Identify organizations that may be susceptible

Acts considered cyberterrorism and / or information warfare can be divided into four separate categories; infrastructure attacks, information attacks, technological facilitation, and promotion.

  What interview techniques do companies employ

Watch the "Interview" video found on the student media website. What interview techniques do companies employ? From your experience, have you been in an interview when these were used? Describe the differences and the approach to being successful ..

  Evaluate threats to network provision and compare solutions

Rubha Reidh (means Red Point in the local Gaelic language, sometimes seen spelt Rua Reidh and pronounced "roo-a ree") is a remote lighthouse on the west coast of Scotland. The lighthouse itself is now automated (as are all lighthouses in the UK) a..

  Comma-delimited text file

This is based on a comma-delimited text file that has already been created containing a 3 digit ID # and a first and last name. The last part of the excercise is as follows.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd