Starting Out with Java: Early Objects (6th Edition)
6th Edition
ISBN: 9780134462011
Author: Tony Gaddis
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Question
Chapter 7.11, Problem 7.22CP
Program Plan Intro
Three-dimensional array:
An array of array of arrays is called as three-dimensional array. It is a collection of two-dimensional arrays, and a two-dimensional array is an array of one-dimensional array.
Example:
Consider an example for three-dimensional array is as follows:
int [][][] a = new int[3][4[][5];
Here, “a” can hold maximum of 60 (3 * 4* 5) elements of type “int”.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
array
Problem2: 2D Arrays
Define a 2D array using Java code that takes from a teacher the total number of rows and the
total number of columns. Then let the teacher fill the array by students IDs and courses marks
for each student. And print the following:
1- Print the array.
2- Print the marks that are less than 50 (mark < 50)
A video rental store keeps DVDs on 50 racks with 10 shelves each. Each shelfholds 25 DVDs. Define a three-dimensional array large enough to represent thestore’s storage system.
Chapter 7 Solutions
Starting Out with Java: Early Objects (6th Edition)
Ch. 7.1 - Write statements that create the following arrays:...Ch. 7.1 - Whats wrong with the following array declarations?...Ch. 7.1 - Prob. 7.3CPCh. 7.1 - Prob. 7.4CPCh. 7.1 - Prob. 7.5CPCh. 7.1 - Prob. 7.6CPCh. 7.1 - Prob. 7.7CPCh. 7.1 - Prob. 7.8CPCh. 7.2 - Prob. 7.9CPCh. 7.2 - Prob. 7.10CP
Ch. 7.2 - A program has the following declaration: double[]...Ch. 7.2 - Look at the following statements: final in...Ch. 7.3 - Look at the following method header: public static...Ch. 7.3 - Write a method named zero, which accepts an int...Ch. 7.6 - Prob. 7.15CPCh. 7.7 - Recall that we discussed a Rectangle class in...Ch. 7.9 - What value in an array does the selection sort...Ch. 7.9 - How many times will the selection sort swap the...Ch. 7.9 - Prob. 7.19CPCh. 7.9 - Prob. 7.20CPCh. 7.9 - If a sequential search is performed on an array,...Ch. 7.11 - Prob. 7.22CPCh. 7.13 - What import statement must you include in your...Ch. 7.13 - Write a statement that creates an ArrayList object...Ch. 7.13 - Write a statement that creates an ArrayList object...Ch. 7.13 - Prob. 7.26CPCh. 7.13 - Prob. 7.27CPCh. 7.13 - Prob. 7.28CPCh. 7.13 - Prob. 7.29CPCh. 7.13 - Prob. 7.30CPCh. 7.13 - Prob. 7.31CPCh. 7 - Prob. 1MCCh. 7 - Prob. 2MCCh. 7 - Prob. 3MCCh. 7 - Prob. 4MCCh. 7 - Array bounds checking happens. a. when the program...Ch. 7 - Prob. 6MCCh. 7 - Prob. 7MCCh. 7 - Prob. 8MCCh. 7 - Prob. 9MCCh. 7 - Prob. 10MCCh. 7 - To store an item in an ArrayList object, use this...Ch. 7 - Prob. 12MCCh. 7 - To delete an item from an ArrayList object, you...Ch. 7 - Prob. 14TFCh. 7 - Prob. 15TFCh. 7 - Prob. 16TFCh. 7 - Prob. 17TFCh. 7 - Prob. 18TFCh. 7 - Prob. 19TFCh. 7 - True or False: The Java compiler does not display...Ch. 7 - Prob. 21TFCh. 7 - True or False: The first size declarator in the...Ch. 7 - Prob. 23TFCh. 7 - Prob. 24TFCh. 7 - int[] collection = new int[-20];Ch. 7 - Prob. 2FTECh. 7 - Prob. 3FTECh. 7 - Prob. 4FTECh. 7 - Prob. 5FTECh. 7 - Prob. 1AWCh. 7 - Prob. 2AWCh. 7 - Prob. 3AWCh. 7 - In a program you need to store the populations of...Ch. 7 - In a program you need to store the identification...Ch. 7 - Prob. 6AWCh. 7 - Prob. 7AWCh. 7 - Prob. 8AWCh. 7 - Prob. 9AWCh. 7 - Prob. 10AWCh. 7 - Prob. 11AWCh. 7 - Prob. 1SACh. 7 - Prob. 2SACh. 7 - Prob. 3SACh. 7 - Prob. 4SACh. 7 - Prob. 5SACh. 7 - The following statement creates an InventoryItem...Ch. 7 - Prob. 7SACh. 7 - Prob. 8SACh. 7 - Rainfall Class Write a RainFall class that stores...Ch. 7 - Payroll Class Write a Payroll class that uses the...Ch. 7 - Charge Account Validation Create a class with a...Ch. 7 - Prob. 4PCCh. 7 - Charge Account Modification Modify the charge...Ch. 7 - Drivers License Exam The local Drivers License...Ch. 7 - Magic 8 Ball Write a program that simulates a...Ch. 7 - Grade Book A teacher has five students who have...Ch. 7 - Grade Book Modification Modify the grade book...Ch. 7 - Average Steps Taken A Personal Fitness Tracker is...Ch. 7 - ArrayOperations Class Write a class name...Ch. 7 - 12.1994 Gas Prices In the student sample programs...Ch. 7 - Sorted List of 1994 Gas Prices Note: This...Ch. 7 - Name Search If you have downloaded this books...Ch. 7 - Population Data If you have downloaded this books...Ch. 7 - World Series Champions If you have downloaded this...Ch. 7 - Search Benchmarks Modify the sequentialSearch and...Ch. 7 - 2D Array Operations Write a program that creates a...Ch. 7 - Prob. 19PCCh. 7 - Trivia Game In this programming challenge, you...Ch. 7 - Prob. 21PC
Knowledge Booster
Similar questions
- The contents of the array below represent a maxHeap. What would be the contents of the array after 70 is added. Briefly explain how 70 would be added. 60 20 30 5 10 15 25arrow_forwardMulti-Dimensional Arrays Create a multi-dimensional array of size 20 by 20. Create the following methods; • Create Board: This method will create the multi-dimensional array and initialize the values to zeros, such as this; 00000000000000000000 00000000000000000000 00000000000000000000 etc • Place Ship: This method will accept as parameters the starting coordinates of the ship, the type, and the direction. (vertical or horizontal) Then it will place the ship on the board by updating the array values to be dash characters, such as this " - " The ships: One Battleship of length 8 o One destroyer of length 2 o Two cruisers of length 4 each O • Print Board: This method will output the contents of the board. Where there are ships, the dash character will be printed, where there are no ships, the zero character will be printed. • Fire: This method will accept two coordinates from the user. If there is a ship at that location, it will update the value to X for a hit. If there is no ship, it…arrow_forwardAn array with more than one index is called a/an: partially filled array. O multidimensional array. O bidirectional array. one dimensional array.arrow_forward
- An array called number contains 20 integer values and must be filled with values in the following way: Fill the array with consecutive even numbers starting from 10. Start again at the first element and increase every fourth element with 3. Replace the value of the first four elements each with its square. Deduct 2 from the last 3 elements. Swap the value of element 5 and element 15. Add the value of the first element to that of the last element Add consecutive integers (starting from 1) to all even elements.Remember, the first element has a subscript of 0 and the last element (element 20) has a subscript of 19.The following must be displayed: All elements must be displayed each on a new line. Identify each element clearly. Display the highest value in the array. The lowest value in the array must be displayed. Count and display how many even values and how many odd values the array contains.arrow_forwardThe subscript of the first indexed variable in an array is: O 0. O 1. O 2. O 3.arrow_forwardArray a is an integer array with all the elements in ascending order. The element at position 15 is the 15th largest and also the 15th smallest. You can assume integers are 4 bytes long. How many bytes are there in the array? O 116 124 O None of the other answers is correct. 120arrow_forward
- AHPA #4: The C ATM Machine• Two people, "a" and "b", have checking and savings accounts.• Create a 2x2 array to hold their amounts: a – checking: $500, savings:$1,000; b – checking: $750, savings: $325.• Have the ATM machine ask the user their name.• Ask the user if they want to withdraw from their checking or their savingsaccount.• Use a switch statement to process different types of accounts.• Create software that will provide an ATM user with theproper change for any dollar amount up to $200.• Example: Run the code for $19, $55, and $200. Is the amount > $100, then provide a $100 bill & subtract $100• Is the amount >= $100, then provide a $100 bill & subtract $100• Is the amount > $20, then provide a $20 bill & subtract $20 [repeat 4times]• Is the amount > $10, then provide a $10 bill and subtract $10• Is the amount > $5, then provide a $5 bill and subtract $5• Provide the remaining amount in single $1 bills so the output should be like shown in…arrow_forwardLab Activity for the students: Exercise 5: Write a program that asks the user to input 8 numbers and save them in a 2D array with 4 rows and 2 columns. The program finds the sum of all elements and prints the array in reverse order. (1 Mark ) Example : If the inputs are 12, 7, 23, 86, 40, 64, 97, 55. Then, the program will print: 55 97 64 40 86 23 7 12 Sum = 384arrow_forwarda class with 10 students that will take 3 exams use 3 arrays to hold the scores for each student and anoither array to hold the average of the 3 exams for each student. Print the table with the scores and averagearrow_forward
- TODO 1: To construct an array of 120 values between -4 and 4, use the NumPy method np.linspace() (docs). To do so, pass the parameters -4, 4, and 120. Put the results in the variable x_values. mu = 0 # mean sig = 1 # std # TODO 1 x_values = display(x_values) todo_check([ (x_values.shape == (120,),'x_values does not have the correct shape of (120,)'), (np.all(np.isclose(x_values, np.array([-4.…arrow_forwardWrite comments in the below code explaining each line . Show it in a picture. Arrays Sales Commissions Use a one-dimensional array to solve the following problem. A company pays its salespeople on a commission basis. The salespeople receive $200 per week plus 9% of their gross sales for that week. For example, a salesperson who grosses $3,000 in sales in a week receives $200 plus 9% of 3,000, or a total of $470. Write a C program (using an array of counters that determines how many of the salespeople earned salaries in each of the following ranges (assume that each salesperson's salary is truncated to an integer.) a) $200-299 b) $300-399 c) $400-499 d) $500-599 e) $600-699 f) $700-799 g) $800-899 h) $900-999 i) $1000 and overarrow_forwardAssignment 5B: Maze Game! 2D Arrays can be used to store and represent information about video game levels or boards. In this exercise, you will use this knowledge to create an interactive game where players attempt to move through a maze. You will start by creating a pre-defined 2D array with the following values: :-, X","X"} "X","W"} "X","_"} "} 'X","X"} {"_" " "y" " " You will then set the player (represented by "O") at index 0, 0 of the array, the top-left corner of the maze. You will use a loop to repeatedly prompt the user to enter a direction ("Left", “Right", “Up", or “Down"). Based on these directions, you will try to move the player. If the location is valid (represented by “_"), you will move the player there If the location is out of bounds (e.g. index 0, -1) or the command is invalid, you will inform the player and prompt them to enter another direction If the location is a wall (represented by “X"), you will tell the user they hit a wall and the game is over. If the…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTMicrosoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:Cengage
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage