Question: Integer variables totalDay and amount are read from input. Complete purchases ( ) ' s recursive case: If day is odd, call purchases ( )
Integer variables totalDay and amount are read from input. Complete purchasess recursive case:
If day is odd, call purchases to compute the next day's amount as the current day's amount minus
Otherwise, call purchases to compute the next day's amount as the current day's amount minus
Ex: If the input is then the output is:
Day: amount:
Note: x returns true if x is odd.
import java.util.Scanner;
public class MerchandiseCount
public static void purchasesint totalDay, int day, int amount
if day totalDay
System.out.printlnDay: totalDay amount: amount;
else
Your code goes here
public static void mainString args
Scanner scnr new ScannerSystemin;
int totalDay;
int amount;
totalDay scnrnextInt;
amount scnrnextInt;
purchasestotalDay amount;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
