Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Floating - point number firstNum is read from input. Declare an array of floating - point numbers, named userNums, with size NUM _ VALS. Then,

Floating-point number firstNum is read from input. Declare an array of floating-point numbers, named userNums, with size NUM_VALS. Then, assign the elements of userNums with firstNum, firstNum +1, firstNum +2, and so on, until all elements have been assigned.
Ex: If the input is 56.4, then the output is:
Array values: 56.457.458.459.4 import java.util.Scanner;
public class UserData {
public static void main(String[] args){
Scanner scnr = new Scanner(System.in);
final int NUM_VALS =4;
double firstNum;
int i;
firstNum = scnr.nextDouble();
/* Your code goes here */
System.out.print("Array values: ");
for (i =0; i < userNums.length; ++i){
System.out.print(userNums[i]+"");
}
System.out.println();
}
}

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

Entity Alignment Concepts Recent Advances And Novel Approaches

Authors: Xiang Zhao ,Weixin Zeng ,Jiuyang Tang

1st Edition

9819942527, 978-9819942527

More Books

Students also viewed these Databases questions