Below is code which defines and creates an Array, myList: int (] myList = new int [5]; //define and create The loop below stores the values 1 to 5 in myList: for (int i = 0; i< 5; i++){ myList [i] = i+1;//store values using a loop The loop below prints the values from first to last in myList: for (int i = 0; i< myList.length; i++) { System.out.print(myList [i)+" "); The code below is used to get user from the user and calculate the sum: import java.util."; public class WhileWithinput { public static void main(String] args) { Scanner reader = new Scanner (System.in); int count = 1; double total = 0; while (count <= 5) { System.out.printin("Enter a decimal number"); double number = reader.nextDouble(); total = total + number; count = count + 1; System.out.println("The total is "+ total); } System.out.printin("The total is "+ total); } 1 CPS 2231 Chapter 7- lab 2 Fall 2019 Use the examples on page 1 to complete the lab below. Please submit a screen print of the Eclipse editor showing your code and output with answers: Write a Java class, XXX_Lab75, where XXX is your Kean email ID. The class will do the following: 1) Consist of two methods: a. main b. printHigherThanAverage public static void printHigherAverage(double [] numbers, double avg) The method will print all the numbers in the array, numbers, which are higher than the average. 2) In the main methods, create an Array which can contain 5 elements of type double 3) In a loop a. Ask the user for 5 values using a Scanner. b. Store the values in the array c. Sum the values 4) At the end of the loop: a. Calculate the average. b. Call the method printHigherAverage and pass it the array and the average.
Below is code which defines and creates an Array, myList: int (] myList = new int [5]; //define and create The loop below stores the values 1 to 5 in myList: for (int i = 0; i< 5; i++){ myList [i] = i+1;//store values using a loop The loop below prints the values from first to last in myList: for (int i = 0; i< myList.length; i++) { System.out.print(myList [i)+" "); The code below is used to get user from the user and calculate the sum: import java.util."; public class WhileWithinput { public static void main(String] args) { Scanner reader = new Scanner (System.in); int count = 1; double total = 0; while (count <= 5) { System.out.printin("Enter a decimal number"); double number = reader.nextDouble(); total = total + number; count = count + 1; System.out.println("The total is "+ total); } System.out.printin("The total is "+ total); } 1 CPS 2231 Chapter 7- lab 2 Fall 2019 Use the examples on page 1 to complete the lab below. Please submit a screen print of the Eclipse editor showing your code and output with answers: Write a Java class, XXX_Lab75, where XXX is your Kean email ID. The class will do the following: 1) Consist of two methods: a. main b. printHigherThanAverage public static void printHigherAverage(double [] numbers, double avg) The method will print all the numbers in the array, numbers, which are higher than the average. 2) In the main methods, create an Array which can contain 5 elements of type double 3) In a loop a. Ask the user for 5 values using a Scanner. b. Store the values in the array c. Sum the values 4) At the end of the loop: a. Calculate the average. b. Call the method printHigherAverage and pass it the array and the average.
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
![Below is code which defines and creates an Array, myList: int [] myList = new int [5]; //define and create
The loop below stores the values 1 to 5 in myList:
for (int i = 0; i< 5; i++) {
myList [i] =i+1; //store values using a loop
The loop below prints the values from first to last in myList:
for (int i = 0; i< myList.length; i++) { System.out.print(myList [i]+"");
The code below is used to get user from the user and calculate the sum:
import java.util.";
public class WhileWithInput {
public static void main(String[] args) {
Scanner reader = new Scanner (System.in);
int count = 1; double total = 0; while (count <= 5) {
System.out.println("Enter a decimal number"); double number = reader.nextDouble();
total = total + number;
count = count + 1;
System.out.printlin("The total is "+ total); }
System.out.println("The total is "+ total); }
1
CPS 2231 Chapter 7- lab 2 Fall 2019
Use the examples on page 1 to complete the lab below. Please submit a screen print of the Eclipse editor
showing your code and output with answers:
Write a Java class, XXX_Lab75, where XXX is your Kean email ID. The class will do the following:
1) Consist of two methods: a. main
b. printHigherThanAverage
public static void printHigherAverage(double [] numbers, double avg)
The method will print all the numbers in the array, numbers, which are higher than the average.
2) In the main methods, create an Array which can contain 5 elements of type double
3) In a loop
a. Ask the user for 5 values using a Scanner. b. Store the values in the array
c. Sum the values
4) At the end of the loop:
a. Calculate the average.
b. Call the method printHigherAverage and pass it the array and
the average.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F54421b2d-e528-47a6-b954-16ebeb785b50%2Fae99403e-d7e0-48c8-a7c2-cb3c2391a2ff%2Fyfbo31k_processed.jpeg&w=3840&q=75)
Transcribed Image Text:Below is code which defines and creates an Array, myList: int [] myList = new int [5]; //define and create
The loop below stores the values 1 to 5 in myList:
for (int i = 0; i< 5; i++) {
myList [i] =i+1; //store values using a loop
The loop below prints the values from first to last in myList:
for (int i = 0; i< myList.length; i++) { System.out.print(myList [i]+"");
The code below is used to get user from the user and calculate the sum:
import java.util.";
public class WhileWithInput {
public static void main(String[] args) {
Scanner reader = new Scanner (System.in);
int count = 1; double total = 0; while (count <= 5) {
System.out.println("Enter a decimal number"); double number = reader.nextDouble();
total = total + number;
count = count + 1;
System.out.printlin("The total is "+ total); }
System.out.println("The total is "+ total); }
1
CPS 2231 Chapter 7- lab 2 Fall 2019
Use the examples on page 1 to complete the lab below. Please submit a screen print of the Eclipse editor
showing your code and output with answers:
Write a Java class, XXX_Lab75, where XXX is your Kean email ID. The class will do the following:
1) Consist of two methods: a. main
b. printHigherThanAverage
public static void printHigherAverage(double [] numbers, double avg)
The method will print all the numbers in the array, numbers, which are higher than the average.
2) In the main methods, create an Array which can contain 5 elements of type double
3) In a loop
a. Ask the user for 5 values using a Scanner. b. Store the values in the array
c. Sum the values
4) At the end of the loop:
a. Calculate the average.
b. Call the method printHigherAverage and pass it the array and
the average.
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 4 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Recommended textbooks for you
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
![Concepts of Database Management](https://www.bartleby.com/isbn_cover_images/9781337093422/9781337093422_smallCoverImage.gif)
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
![Prelude to Programming](https://www.bartleby.com/isbn_cover_images/9780133750423/9780133750423_smallCoverImage.jpg)
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
![Sc Business Data Communications and Networking, T…](https://www.bartleby.com/isbn_cover_images/9781119368830/9781119368830_smallCoverImage.gif)
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY