Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

write a Java program that determines the smallest integer value in a set. The in

ID: 440017 • Letter: W

Question

write a Java program that determines the smallest integer value in a set. The input will be a single line of text containing 0 or more sets, The input will be a single line of text containing 0 or more sets, such as: { 3, 9 ,53,98 ,105 } {955, 722, -5, -7, 21} find the smallest integer in each of the sets in the input; in this example those are 1 and -6 respectively. The solution uses the following libraries ? From the String class: charAt, length, indexOf, substring, and trim. ? From the Character class: isWhitespace and isDigit ? From the Integer class: parseInteger

Explanation / Answer

//this code find maximum, minimum, sum and average of the given list import java.util.Scanner; public class exc5 { public static void main (String[] args) { System.out.println("Write a list of nonnegative integers, each seperated by a space. To signal the end of the list, write a negative integer. The negative integer will not be counted"); Scanner keyboard = new Scanner (System.in); keyboard.useDelimiter(" | "); int count = 0; int sum = 0; int max = 0; int min = max; double average = 0; boolean notNull = true; while(notNull == true) { int getInt = keyboard.nextInt(); if(getInt < 0) { notNull = false; } else { if(getInt > max) { max = getInt; } if(getInt