MindTapV2.0 for Farrell's Java Programming with 2021 Updates, 9th Edition [Instant Access], 1 term
9th Edition
ISBN: 9780357505540
Author: Farrell; Joyce
Publisher: Cengage Learning US
expand_more
expand_more
format_list_bulleted
Concept explainers
Expert Solution & Answer
Chapter 8, Problem 2RQ
<PROGRAM-DESCRIPTION-ANSWER>
The user might reserve memory for it in the same statement when he declare an array.
Hence the correct option is “(B)”
</PROGRAM-DESCRIPTION-ANSWER>
Explanation of Solution
Array:
- The array is a collection to store the elements as a single unit.
- The elements in the array can be a primitive value like byte, short, int, long, float, double, and char. Also, the elements can be any object in java...
Expert Solution & Answer
Trending nowThis is a popular solution!
Students have asked these similar questions
X482: Make Perfect Array
The mere presence of oversized arrays makes Priscilla Perfect sick to her stomach. Such wasted space is an imperfection she cannot bear. As her oldest and dearest friend this worries you greatly. If you
were a doctor you might try to find a cure to her sickness, but you are a programmer. A program must be written to alleviate her pain!
For any array given that has empty slots create a new array that is perfect. Unused slots will have a value of 0. All unused slots are guaranteed to be at the end of the array. There will never be unused
slots in the middle.
java.util.Arrays has been enabled.
Examples:
makePerfect({1, 1, 4, 5, 6, 0, e, e, 0}) -> {1, 1, 4, 5, 6}
makePerfect({1, 3, 4, 2, 6, 0, e, e, 0}) -> {1, 3, 4, 2, 6}
Program Number 2: Password Verifier Imagine you are developing a software package that requires users to enter their own passwords. Your software requires that user’s passwords meet the following criteria:
The password should be at least six characters long.
The password should contain at least one uppercase and at least one lowercase letter.
The password should have at least one digit.
Contains at least one @ in array.
Write a program that asks for a password and then verifies that it meets the stated criteria. If it doesn’t, the program should display a message telling the user why.
var newStaff =new Employee[3]; is used to:
Select one:
a.
Creates and initializes an Array with three objects of type Employee
b.
The statement is not valid in Java
c.
Create an Array to store two Employee objects
d.
Create an Array to store three objects of type Employee
Chapter 8 Solutions
MindTapV2.0 for Farrell's Java Programming with 2021 Updates, 9th Edition [Instant Access], 1 term
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.Similar questions
- (Electrical eng.) Write a program that declares three one-dimensional arrays named volts, current, and resistance. Each array should be declared in main() and be capable of holding 10 double-precision numbers. The numbers to store in current are 10.62, 14.89, 13.21, 16.55, 18.62, 9.47, 6.58, 18.32, 12.15, and 3.98. The numbers to store in resistance are 4, 8.5, 6, 7.35, 9, 15.3, 3, 5.4, 2.9, and 4.8. Your program should pass these three arrays to a function named calc_volts(), which should calculate elements in the volts array as the product of the corresponding elements in the current and resistance arrays (for example ,volts[1]=current[1]resistance[1]). After calc_volts() has passed values to the volts array, the values in the array should be displayed from inside main().arrow_forwardPython: Numpy def shopping_spree(spending_limit, store_nums):"""QUESTION 1- You and your friends decide to go on a shopping spree! You each have a spendinglimit listed in a 1D array called spending_limit.- You each know you will be going to a specific number of stores, store_nums, which is alsoa 1D array.- Sales tax is 7% at every store.- Calculate the average amount that you and each of your friends can spend at astore- Excluding sales tax from this calculation.- Return an array of how much you can each spend at a store, excluding sales tax.- THIS MUST BE DONE IN ONE LINEArgs:spending_limit (np.array)store_nums (np.array)Returns:np.array>> store_nums = np.array([15, 12, 8, 3, 4, 3, 6, 5, 7, 4])spending_limit = np.array([200, 500, 330, 120, 85, 60, 220, 190, 490, 300])>> print(shopping_spree(spending_limit, store_nums))[12.46105919 38.94080997 38.55140187 37.38317757 19.85981308 18.6915887934.26791277 35.51401869 65.42056075 70.09345794]"""# store_nums = np.array([15, 12,…arrow_forwardFYI: Please write the code in Pseudocode (no programming language please) 1. Write pseudocode to load a single array with data. Then search that array for a match. Here are the specifics. You do NOT have to write the entire program. Load the array with data from a file named customerNumbers Ask the user to enter their customer number Search the array for the customer number If you find a match output FOUND If there is no match output NOT FOUNDarrow_forward
- While passing an array as an actual argument, the function call must have the array name A. with empty brackets B. with its size C. alone D. none of the abovearrow_forwardYou can copy all elements of one array into one another with an assignment statement. True or Falsearrow_forwardNeed help coding in Java Write an application that stores at least five different college courses (such as CIS101), the time it first meets in the week (such as Mon 9 am), and the instructor (such as Johnson) in a two-dimensional array. Allow the user to enter a course name and display the corresponding time and instructor. If the course exists twice, display details for both sessions. If the course does not exist, display Invalid Entry: No Such course. Use the following values: Course Time Instructor CIS101 Mon 9 am Farrell CIS210 Mon 11 am Patel MKT100 Tues 8:30 am Wong ACC150 Tues 6 pm Deitrich CIS101 Fri 1 pm Lennonarrow_forward
- Fill-in-the-Blank Array names can be used as __________ and vice versa.arrow_forwardAn array ’s elements are related by the fact that they have the same________ and_______ .arrow_forwardProgramming: Multi-Array Assignment Instructions Overview Using a two-dimensional array, you will create the game battleship using a text file that contains the board. The user will enter coordinates to try and find ships and sink them. Instructions Imagine you are using a two-dimensional array as the basis for creating the game battleship. In the game of battleship, a `~' character entry in the array represents ocean (i.e., not a ship), a `#' character represents a place in the ocean where part of a ship is present, and a `H' character represents a place in the ocean where part of a ship is present and has been hit by a torpedo. Thus, a ship with all `H' characters means the ship has been sunk. Declare a two-dimensional array that is 25 x 25 that represents the entire ocean and an If statement that prints "HIT" if a torpedo hits a ship given the coordinates X and Y. Create a text file of 25 line. Each line has 25 characters. ~ represents water and # represents part of…arrow_forward
- Programming: Multi-Array Assignment Instructions Overview Using a two-dimensional array, you will create the game battleship using a text file that contains the board. The user will enter coordinates to try and find ships and sink them. Instructions Imagine you are using a two-dimensional array as the basis for creating the game battleship. In the game of battleship, a `~' character entry in the array represents ocean (i.e., not a ship), a `#' character represents a place in the ocean where part of a ship is present, and a `H' character represents a place in the ocean where part of a ship is present and has been hit by a torpedo. Thus, a ship with all `H' characters means the ship has been sunk. Declare a two-dimensional array that is 25 x 25 that represents the entire ocean and an If statement that prints "HIT" if a torpedo hits a ship given the coordinates X and Y. Create a text file of 25 line. Each line has 25 characters. ~ represents water and # represents part of…arrow_forwardC# Write a program called DeliveryCharges for the package delivery service in Exercise 4. The program should again use an array that holds the 10 zip codes of areas to which the company makes deliveries. (Note that this array has been created for your and does not need to be changed.) A parallel array has also been created containing 10 delivery charges that differ for each zip code. Prompt a user to enter a zip code, and then display either a message indicating the price of delivery to that zip code or a message indicating that the company does not deliver to the requested zip code. For example, if the zip code is in the delivery area, such as 90210, output Delivery to 90210 ok. Delivery charge is $10.00. If the zip code is not in the delivery area, such as 85205, output Sorry - no delivery to 85205. In order to prepend the $ to currency values, the program will need to use the CultureInfo.GetCultureInfo method. In order to do this, include the statement using System.Globalization; at…arrow_forwardFill-in-the-Blank By using the same _________ for multiple arrays, you can build relationships between the data stored in the arrays. These arrays are referred to as parallel arrays.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageProgramming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage Learning
- C++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr