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

Below is a program I am working on that is supposed to take in a list of numbers

ID: 3778955 • Letter: B

Question

Below is a program I am working on that is supposed to take in a list of numbers into an array and then read them back indicating the smallest number with the following printed beside it (<---smallest number). I do not understand why the program is not printing the right output. Please help! Below my program is the CORRECT sample output but NOT the one I am receiving. Thank you!

import java util Scanner public class SmallestInArray public static void main StringO args)H final int LENGTH 100 int value 1; int currentSize 0; int O values new int 11001 Read inputs System. out printInC"Please enter values, Q to quit: Scanner scan new Scanner System. in while Oscan. hasNextDoubleC) && currentSize values length) values Dvalue scan nextIntO; current Size++ double smallest values C01 for (int i 1; i

Explanation / Answer

Every number's remainder with 1 is always 0. Try this

for(i=0;i<currentSize;i++){

System.out.print(values[i]);

if(values[i]==smallest){

System.out.println(" <==smallest value");

}else{

System.out.println();

}

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote