Question: Write findStock ( ) ' s recursive case to recursively call findStock ( ) with month + 1 and total decreased by 5 0 0

Write findStock()'s recursive case to recursively call findStock() with month +1 and total decreased by 500.
Ex: If the input is 2500, then the output is:
month: 1, total: 2500
month: 2, total: 2000
month: 3, total: 1500
month: 4, total: 1000
Low stock limit is reached in month 4.
Note: Assume input is non-negative.
import java.util.Scanner;
public class InStockAnalysis {
public static void findStock(int month, int total){
System.out.println("month: "+ month +", total: "+ total);
if (total <=1000){
System.out.print("Low stock limit is reached in month "+ month +".");
}
/* Your code goes here */
}
public static void main(String[] args){
Scanner scnr = new Scanner(System.in);
int total;
total = scnr.nextInt();
findStock(1, total);
}
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!