Q1. Produce a method that reads in a set of values (double) from the user and returns them. Use this header: public static double[] getNumsFromUser (String msgl, String msg2) The implementation of the method should start with a message to input the total number of array elements, followed by a message to enter all the array elements. The method returns the array of elements. The two strings msg1 and msg2 that are passed to the method as parameters will be the two messages that tell the user what to do. In the main class, use the following program outline to test this method: public class Q1 { public static void main(String[] args) { String s1 = "Enter number of students: "; String s2 = "Enter student grades: "; double[] numbers = System.out.println(Arrays.toString(numbers)); getNums FromUser(s1, s2); %3D public static double[] getNumsFromUser(String msg1, String msg2){ //your code goes here } Sample run Enter number of students: 4 Enter student grades: 12.5 23 11.5 27 [12.5, 23.0, 11.5, 27.0]
Q1. Produce a method that reads in a set of values (double) from the user and returns them. Use this header: public static double[] getNumsFromUser (String msgl, String msg2) The implementation of the method should start with a message to input the total number of array elements, followed by a message to enter all the array elements. The method returns the array of elements. The two strings msg1 and msg2 that are passed to the method as parameters will be the two messages that tell the user what to do. In the main class, use the following program outline to test this method: public class Q1 { public static void main(String[] args) { String s1 = "Enter number of students: "; String s2 = "Enter student grades: "; double[] numbers = System.out.println(Arrays.toString(numbers)); getNums FromUser(s1, s2); %3D public static double[] getNumsFromUser(String msg1, String msg2){ //your code goes here } Sample run Enter number of students: 4 Enter student grades: 12.5 23 11.5 27 [12.5, 23.0, 11.5, 27.0]
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
![Q1.
Produce a method that reads in a set of values (double) from the user and returns
them. Use this header:
public static double[] getNumsFromUser (String msg1, String msg2)
The implementation of the method should start with a message to input the total number of
array elements, followed by a message to enter all the array elements. The method returns
the array of elements. The two strings msg1 and msg2 that are passed to the method as
parameters will be the two messages that tell the user what to do.
In the main class, use the following program outline to test this method:
public class Q1 {
public static void main(String[] args) {
String s1 = "Enter number of students: ";
String s2 = "Enter student grades: ";
double[] numbers = getNumsFromUser(s1, s2);
System.out.println(Arrays.toString(numbers));
public static double[] getNumsFromUser(String msg1, String msg2){
//your code goes here
}
Sample run
Enter number of students: 4
Enter student grades: 12.5 23 11.5 27
[12.5, 23.0, 11.5, 27.0]
39%
9°C
T80
F11
F4
F5
F6
F7
F8
F9
F10
(8)](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fcd4867d4-8ed0-437f-b40f-72981102d206%2F65e479fa-4d48-4de5-a842-874fb9da9647%2Fl4dkis9_processed.jpeg&w=3840&q=75)
Transcribed Image Text:Q1.
Produce a method that reads in a set of values (double) from the user and returns
them. Use this header:
public static double[] getNumsFromUser (String msg1, String msg2)
The implementation of the method should start with a message to input the total number of
array elements, followed by a message to enter all the array elements. The method returns
the array of elements. The two strings msg1 and msg2 that are passed to the method as
parameters will be the two messages that tell the user what to do.
In the main class, use the following program outline to test this method:
public class Q1 {
public static void main(String[] args) {
String s1 = "Enter number of students: ";
String s2 = "Enter student grades: ";
double[] numbers = getNumsFromUser(s1, s2);
System.out.println(Arrays.toString(numbers));
public static double[] getNumsFromUser(String msg1, String msg2){
//your code goes here
}
Sample run
Enter number of students: 4
Enter student grades: 12.5 23 11.5 27
[12.5, 23.0, 11.5, 27.0]
39%
9°C
T80
F11
F4
F5
F6
F7
F8
F9
F10
(8)
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education