Question: Define the method outputVal() that takes two integer parameters and outputs the product of all negative integers starting with the first and ending with the

Define the method outputVal() that takes two integer parameters and outputs the product of all negative integers starting with the first and ending with the second parameter. If no negative integers exist, product is 1. End with a newline. The method does not return any value. Ex: If the input is -4 7, then the output is: 24 Note: Negative numbers are less than 0.

import java.util.Scanner;

public class ValuePrinter {

public static void outputVal(int num1, int num2){

Insert code here

}

public static void main(String[] args) {

Scanner scnr = new Scanner(System.in);

int num1;

int num2;

num1 = scnr.nextInt();

num2 = scnr.nextInt();

outputVal(num1, num2);

}

}

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 Databases Questions!