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

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

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