subject

IN JAVAWrite three statements to print the first three elements of array runTimes. Follow each statement with a newline. Ex: If runTime = {800, 775, 790, 805, 808}, print:800 775 790Note: These activities may test code with different test values. This activity will perform two tests, the first with a 5-element array (int runTimes[5]), the second with a 4-element array (int runTimes[4]). See How to Use zyBooks. Also note: If the submitted code tries to access an invalid array element, such as runTime[9] for a 5-element array, the test may generate strange results. Or the test may crash and report "Program end never reached", in which case the system doesn't print the test case that caused the reported message. import java. util. Scanner;public class PrintRunTimes { public static void main (String [] args) { int[] runTimes = new int[5]; // Populate array runTimes[0] = 800; runTimes[1] = 775; runTimes[2] = 790; runTimes[3] = 805; runTimes[4] = 808; /* Your solution goes here */ return; }}2. Write a for loop to print all elements in courseGrades, following each element with a space (including the last). Print forwards, then backwards. End each loop with a newline. Ex: If courseGrades = {7, 9, 11, 10}, print:7 9 11 10 10 11 9 7 Hint: Use two for loops. Second loop starts with i = NUM_VALS - 1.Note: These activities may test code with different test values. This activity will perform two tests, the first with a 4-element array (int courseGrades[4]), the second with a 2-element array (int courseGrades[2]). See How to Use zyBooks. Also note: If the submitted code tries to access an invalid array element, such as courseGrades[9] for a 4-element array, the test may generate strange results. Or the test may crash and report "Program end never reached", in which case the system doesn't print the test case that caused the reported message. import java. util. Scanner;public class CourseGradePrinter { public static void main (String [] args) { final int NUM_VALS = 4; int[] courseGrades = new int[NUM_VALS]; int i = 0; courseGrades[0] = 7; courseGrades[1] = 9; courseGrades[2] = 11; courseGrades[3] = 10; /* Your solution goes here */ return; }}

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 21:20
Your program will make use of long long int variables for all calculations. note: the use of long long int requires that you have c++11 support. you should have this automatically if you are using a newer version of visual studio. the support is there for gcc as well, but you may need the -std=c++11 or -std=c++0x compiler flag. you first need to read in the total number of seconds. there is no prompt for the read (that is, you just do the cin without using a cout to display a prompt). this is going to seem a little strange when you are running your program in your ide
Answers: 2
question
Computers and Technology, 22.06.2019 03:30
Which group on the home tab allows you to add shapes to a powerpoint slide?
Answers: 1
question
Computers and Technology, 22.06.2019 18:00
Determine whether the following careers would require training or college.
Answers: 1
question
Computers and Technology, 23.06.2019 16:00
Kenny works with an it company. his company is about to launch new software in the market. he has to ensure that this new software is functional and meets all of the quality standards set up at the planning stage. which job profile is kenny likely to have? kenny is likely to have the job profile of a blank .
Answers: 2
You know the right answer?
IN JAVAWrite three statements to print the first three elements of array runTimes. Follow each state...
Questions
question
Mathematics, 08.04.2021 01:00
question
History, 08.04.2021 01:00
question
English, 08.04.2021 01:00
question
Mathematics, 08.04.2021 01:00
Questions on the website: 13722361