Write a program which does the following: 1. Take 10 inputs in a loop from the user and store it in a double data type array. 2. Using a 'for-each' loop, calculate and print the total sum of even numbers in the array. 3. And print the average of all numbers in the array. 4. Write Javadoc comments for the class mentioning your name as author and a brief description of the class. 5. Submit the program and screenshots of the output and Javadoc HTML page. Example: If the array has {1,3,5,4,2,7,8,6,9,10}, then Sum of even numbers would be: 30 and the average would of all numbers be 55/10 = 5.5
Q: Simulate binary search Use array {1, 2, 3, 4, 5, 6, 7} to simulate binary search of 3. For each…
A: Solution: Binary Search: Binary search is used to search a key element from multiple elements.…
Q: Write a java programe named counter that ask the user to enter 12 real numbers and store them in an…
A: The Scanner class of java.util package gives you methods like nextInt(), nextByte(), nextFloat()…
Q: This is for Java Programming In my code, I'm missing a new line at the end of an array. I'm not…
A: for (i = 0; i < n; i++) array[i] = scnr.nextInt(); a = scnr.nextInt();…
Q: (B) Write a Java program that crates an array of 100 random lowercase letters, and then converts a…
A: The name of the Java class is Letters. Using the block/paragraph comment write the student name and…
Q: Write a Java program named RandomNumber that generates 25 random integer numbers (their range must…
A: Since Question B is incomplete we have only answered Question A. The program is implemented in Java.…
Q: Fill in the blanks in the code below so that, when the code runs, its output is: 1) got null pointer…
A: Below is the answer to above question. I hope this will be helpful for you...
Q: I am trying to figure out why the sum at the end of my Java code is not working correctly. It keeps…
A: import java.io.FileWriter; import java.io.File;import java.util.Scanner; public class Main{…
Q: Write a program to extend the below program, by adding an option 'f' to the menu program. If this…
A: So, we have to add an option while displaying menu options and also a case in switch statement
Q: Write a Java program to reverse an array of integer values. PS: Please upload the output and say…
A: It is asked to provide the java program for reversing an integer array. A temporary array is used to…
Q: Instruction: Create a java program that generates elements (randomly from 10 – 75) of a…
A: public class Main{ public static boolean isPrime(int num) { for (int i = 2; i <= num…
Q: Write a Java program that will ask the user to enter a string then copy the given string to a char…
A: The program asks that given a string, convert it into a character array and then swap the last and…
Q: Modify the code to read integer values from the keyboard, store them into a 15 element array, then…
A: import java.util.Scanner; import java.io.*; Answer is public class Storeintoarr{ public static void…
Q: Create a Java program that uses a loop for • Reads from the console the names, weight in kg and…
A: public class Main { //Main Function public static void main(String[] args) { //Creating the…
Q: Write a program that grades arithmetic quizzes as follows: (Use the below startup code for…
A: The, code has given below:
Q: Write a Java program named Occurrence that asks the user to enter 10 integer numbers and store them…
A: Step-1: Start Step-2: Declare an array arr of size 10 Step-3: Declare two variable x and count…
Q: Write a java program (class) called Grades to do the following. Must use an array. Ask the user for…
A: GIVEN: Write a java program (class) called Grades to do the following. Must use an array. Ask the…
Q: Please create a program in Java that will read through a file of 25 words(one of them being Waldo)…
A: Find the code below.
Q: Program 1 : Write a program which does the following: Take 10 inputs in a loop from the user and…
A: As per our guidelines we are supposed to answer only one question. Kindly repost the remaining…
Q: Please make it run out like the EXPECT PICTURES
A: // Step 1: Import Java classes Arrays, Random, and Scanner import java.util.Arrays;import…
Q: Write the output of the following Java program segment. Write only the output, nothing else!…
A: Here ArrayList<Integer> a2 will be {20,24,28,32,36,40} Hence System.out.println(a2.get(4) -…
Q: Read the file containing integer values and add these values to the list. ArrayList • For…
A: Create the file with the intergers. In the main method create the arraylist of the integers. Then…
Q: Task 6 Implement the design of the Laptop class so that the following output is produced [You are…
A: Code:- class Laptop: #declare a class called Laptop laptopCount=0 #initialize laptopCount to…
Q: Asking again. IN JAVA please Given a text file containing the availability of food items, write a…
A: Code Screenshot :
Q: Write a java program that declares an array to hold 12 integers. The contents of the array should…
A: Given: Write a java program that declares an array to hold 12 integers. The contents of the array…
Q: Write a program to extend program below, by adding an option 'f' to your menu program. If this…
A: NOTE: - The code being shared has not been modified much as asked only Task.java is created having…
Q: Write a Java program that creates and initializes an array of integers. Then create another array…
A: The mechanism of developing and implementing an executable computer program to achieve a particular…
Q: Modify the program below, by adding an option 'f' to your menu program. If this option is chosen,…
A: NOTE: - The only case 'f' is introduced in the main function and a static method named…
Q: Write a piece of Java that prompts the users for a text file name creates a scanner for the file and…
A: Step 1: Prompt and accept the file name from the user. Step 2: Create an instance of Scanner class.…
Q: I already have the code for the assignment below, but there are some errors in the code. Please help…
A: As the "words.txt" file has not been provided by you so just trying to remove the error you are…
Q: Given the following array and what it looks like when printed to the console: char a[3][4] = {…
A: Given the following array and what it looks like when printed to the console:char a[3][4] = {…
Q: Write a java program that: Declare an array capable of holding 4 integers. It must be 4 integers…
A: import java.util.Scanner; public class ExpandArray { public static void main(String[] args) {…
Q: Write a Java program that asks the user to enter the size for an Array. Then fill the array with…
A: I have provided JAVA CODE along with CODE SCREENSHOT and also provided OUTPUT…
Q: Draw a memory diagram of the variables of the following code after the execution of the code. Please…
A: According to the information given:- We have to draw a memory diagram of variable in the program.
Q: Requirements: Use Java Programming only. Show screenshots of your output. Without using arrays (to…
A: GIVEN: Requirements: Use Java Programming only. Show screenshots of your output. Without using…
Q: Instruction: Create a java program that generates elements (randomly from 10 - 75) of a…
A: Here I have created a 2-dimensional array of size 5x5. Then, I have looped over the index of the…
Q: Write the exact output that you expect to see on the screen when the indicated statements are…
A: Lets analyse the given code: int[] x={10,15,20};//integer array declared with 3 values 10,15,20…
Q: Write a java program called GradesAverage, which prompts user for the number of students, reads it…
A: Answer is given below .
Q: ze of the 2D square array. Assume the size is at least 5 . Note that the array size may be an even…
A: Code: import java.util.Scanner; public class Main { public static void main(String[] args) {…
Q: Create an enum ShapeColor, which has the following entries: SHAPE_COLOR_RED, SHAPE_COLOR_BLUE,…
A: enum is he keyword used to create an enum in Java
Q: Create a Java program with a method that searches an integer array for a specified integer value…
A: Programming instructions: First, create an array and initialize it. Then, take input from the user…
Q: Write a java program (class) called Grades to do the following. Must use an array. Ask the user for…
A: function main: Start Declare array as int arr[] = new int[20] Declare and initialize sum = 0…
Q: Write a Java program that creates and initializes an array of integers. Then it reads from the user…
A: Required: Write a Java program that creates and initializes an array of integers. Then it reads from…
Q: import java.util.Scanner; class Main { public static void main(String args[]) { Scanner…
A: The program is written in Java. Please find the program code and output in the below steps.
Q: . Write a Java program to test if an array contains a specific value.
A: To write a Java program to test if an array contains a specific value.
Q: int a[10] = {1,2,3}; 1. Write a loop to print the array to the console. 2. Write the output of…
A: Since the programming language is not mentioned , I have done the code in C++ language. Algorithm :…
Q: I am trying to figure out why the sum at the end of my Java code is not working correctly. It keeps…
A: the answer is given below:-
Q: need help finishing/fixing this java code so it prints out all the movie names that start with the…
A: Movie.java works fine whereas in MovieDemo.java, we have to add another method to match movies based…
Q: Fill in the blanks in the code below so that, when the code runs, its output is: 1) got null pointer…
A:
Q: Write a program in java that will continue to prompt the user for numbers, storing them in an array,…
A: 1)use while(1) to read input from user multiple times and assign it to array 2)if input is Done…
Q: Write a Java program that obtains products' numbers (array named products[]), and allows the user to…
A: The Answer is given below step.
Please use Java to complete the problem in the attatchment. Thank you!
Step by step
Solved in 3 steps with 1 images
- Write a complete Java program to execute what is asked in each item below: a. Input 8 different names and store them into an array b. Display all the contents of the array. c. Display the 2nd , 4th, 6th , and the 8th elements in the array using for loop. d. Compute the sum of the 2nd , 4th, 6th , and the 8th elements in the array using for loopCreate a Java program to: Ask the user to input score for 10 students. If it is an invalid value (i.e. less than 0 or greater than 100), keep asking the user to re-input for this student. a. Create an array to store the scores. b. Use a regular condition in the while loop, or using infinite while loop and break statement to achieve the same goal (the latter implementation might be more concise). c. Print all the scores, one at each line. Test case: You can use smaller array (say size 3) to test the program first by defining a constant variable for the total number of students and change it to 10 in the end. Here are two possible test cases of input and output for a size 3 array: (1) Input: 87, 105, 104, 100, -45, 58 Output: 8710058 (2) Input: 200, 300, 400, 90,0, -60, -40, 70 Output:90070CODE IN JAVA design a program that grades arithmetic quizzes as follows: (Use the below startup code for Quizzes.java and provide code as indicated by the comments) 1. Ask the user how many questions are in the quiz. 2. Use a for loop to load the array. Ask the user to enter the key (that is, the correct answers). There should be one answer for each question in the quiz, and each answer should be an integer. They can be entered on a single line, e.g., 34, 7, 13, 100, 8 might be the key for a 5-question quiz. You will need to store the key in an array called "key". 3. Ask the user to enter the student's answers for the quiz to be graded. There needs to be one answer for each question. Note that each answer can simply be compared to the key as it is entered. If the answer is correct, add 1 to a correct answer counter. need this in a separate for loop from the loop used to load the array. 4. When the user has entered all of the answers to be graded, print the number correct…
- // WRITE YOUR CODE HERE TO PRODUCE THE OUTPUT SHOWN BELOW // allocate array of Time references // input meeting times for each meeting in a loop and // instantiate a Time object in the array, for each meeting // Output the times for the meetings that are later today // Determine which is the last meeting of the day, // and output it if it is later today. // Or tell the user they have no more meetings today import java.util.Scanner; class Main{ public static void main(String args[]) { Scanner scan = new Scanner(System.in); String timeString; int numMeetings; System.out.print("What time is it now? "); timeString = scan.nextLine(); Time.setCurTime(timeString); System.out.print("Current time: "); Time.showCurTime(); System.out.println(); System.out.print("How many meetings do/did you have today? "); numMeetings = scan.nextInt(); scan.nextLine(); // dispose of newline character }} /* Sample Output: What time is it now?…Program 1 : Write a program which does the following: Take 10 inputs in a loop from the user and store it in a double data type array. Using a ‘for-each’ loop, calculate and print the total sum of even numbers in the array. And print the average of all numbers in the array. Write Javadoc comments for the class mentioning your name as author and a brief description of the class. Submit the program and screenshots of the output and Javadoc HTML page. Program 2 : Write this program using “for-each” loop to get the same output as the “for” loop in below program: (See attached image) Program 3: Given the below 2 arrays: int arr1[] = { 9,8,7,6,5,4,3,2,1,0 }; int arr2[] = { 99, 89, 79, 69, 59 }; Write a program to replace 79 in arr2 with 4 from arr1. Print the final arr2 using Arrays.toString() method.This lab works with arrays. Declare a constant “ SIZE = 5 ” Declare an array of ints , of size SIZE . Initializethat array to have the values 10, 12, 15, 19, 6 .– Write a loop that calculates and prints out the minimum value of the array.– Write a loop that calculates and prints out the maximum value of the array.– Write a loop that calculates and prints out the average value of the array. THE PROGRAM SHOULD MATCH THE INCLUDED PHOTO
- Write a java program that declares an array to hold 12 integers. The contents of the array should be the values 2,4,6,8,10,12,14,16,18,20,22,24. Use a for-loop to initialize the contents of the array to these values. After initializing the array to these values, the program should display the contents of the array. Suggested output: The contents of the array is: Index Value 0 2 1 4 Etc…..Write a program that grades arithmetic quizzes as follows: (Use the below startup code for Quizzes.java and provide code as indicated) Ask the user how many questions are in the quiz. Use a for loop to load the array. Ask the user to enter the key (that is, the correct answers). There should be one answer for each question in the quiz, and each answer should be an integer. They can be entered on a single line, e.g., 34, 7, 13, 100, 8 might be the key for a 5-question quiz. You will need to store the key in an array called “key”. Ask the user to enter the student’s answers for the quiz to be graded. There needs to be one answer for each question. Note that each answer can simply be compared to the key as it is entered. If the answer is correct, add 1 to a correct answer counter. Do this in a separate for loop from the loop used to load the array. When the user has entered all of the answers to be graded, print the number correct and the percent correct. When this works, nest your for…2. Write a program to create a 2-D array of size 3 X 3. The user enters the data. Then, display the data of the array. This is just to make sure you understand 2-D arrays. Sum the columns of the array. Print this out. Sum the rows of the array. Print that out. Find the highest number in the array. Make sure Java standards and good formatting are followed.
- Write a complete JAVA program to execute what is asked in each item below: a. Input 7 numbers and store it into an array and compute the sum of the 7 inputted numbers at the same time. b. Display all the contents of the array. c. Display the 1st , 3rd, 5th , and the 7th elements in the array using for loop. d. Compute the sum of the 1st , 3rd, 5th , and the 7th elements in the array using for loop.Design a program that asks the user to enter a store’s sales for each day of a 7 day week. The amounts should be stored in an array. Use a loop to calculate the total sales for the week, the average sales per day, and also display the list of values. This is for java.Write a java program: Question 1 Write a program that allows the user to enter name and grade until "QUIT" is entered for name. The grade should be a number between 0 and 100. If the user input of a grade is not in this range, you should ask the user to re-input the grade. Store all the names in an array called names, and all the grades in an array called grades. Print out all the names and the corresponding grades. For Example, Input Enter name: Alice Enter grade: 90 Enter name: Bob Enter grade: 80 QUIT Expected output Name: Alice, Grade: 90 Name: Bob, Grade: 80