Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program that first gets a list of integers from input. The input begins with an integer indicating the number of integers that

 

Write a program that first gets a list of integers from input. The input begins with an integer indicating the number of integers that follow. Then, get the last value from the input, which indicates a threshold. Output all integers less than or equal to that last threshold value. Assume that the list will always contain fewer than 20 integers. Ex: If the input is: 5 50 60 140 200 75 100 the output is: 50,60,75, The 5 indicates that there are five integers in the list, namely 50, 60, 140, 200, and 75. The 100 indicates that the program should output all integers less than or equal to 100, so the program outputs 50, 60, and 75. For coding simplicity, follow every output value by a comma, including the last one. Such functionality is common on sites like Amazon, where a user can filter results. LAB ACTIVITY 5.16.1: LAB: Output values below an amount 1 import java.util.Scanner; 2 3 public class LabProgram { 4 5 6 7 8 9 10} 11 LabProgram.java public static void main(String[] args) { Scanner scnr = new Scanner(System.in); int[] userValues = new int[20]; // List of integers from input /* Type your code here. / } 0/10 Load default template... When analyzing data sets, such as data for human heights or for human weights, a common step is to adjust the data. This adjustment can be done by normalizing to values between 0 and 1, or throwing away outliers. For this program, adjust the values by dividing all values by the largest value. The input begins with an integer indicating the number of floating-point values that follow. Assume that the list will always contain fewer than 20 floating-point values. Output each floating-point value with two digits after the decimal point, which can be achieved as follows: System.out.printf("%.2f", yourValue); Ex: If the input is: 5 30.0 50.0 10.0 100.0 65.0 the output is: 0.30 0.50 0.10 1.00 0.65 The 5 indicates that there are five floating-point values in the list, namely 30.0, 50.0, 10.0, 100.0, and 65.0. 100.0 is the largest value in the list, so each value is divided by 100.0. For coding simplicity, follow every output value by a space, including the last one. 484934.3417574.37 LAB ACTIVITY 5.17.1: LAB: Adjust list by normalizing 1 import java.util.Scanner; 2 3 public class LabProgram { 4 5 6 7} 8 public static void main(String[] args) { /* Type your code here. / } LabProgram.java 0/10 Load default template...

Step by Step Solution

3.44 Rating (167 Votes )

There are 3 Steps involved in it

Step: 1

Answer Python program this list stores the integers listofintegers prompting user for number of i... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

C++ Primer Plus

Authors: Stephen Prata

6th Edition

978-0321776402, 0321776402

More Books

Students also viewed these Programming questions