Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
11th Edition
ISBN: 9780134670942
Author: Y. Daniel Liang
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 30.8, Problem 30.8.1CP
Can the following code be used to replace line 19 in Listing 30.7?
DoubleStream.of(numbers).fi1ter(e −> e >
DoubleStream.of(numbers).average<)).count());
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
PHP
Write a matchIPAddress function
Write a function matchIPAddress($str) that takes a string representing an IP address as a parameter. The function should return true if the IP address is valid, and false if it is not. An IP address consists of a series of 4 numbers on the range 0-255 separated by dots (e.g. 192.168.0.1). Use regular expressions with capture groups and some additional validation in your solution (e.g. preg_match).]
When I am putting -
getline(cin, name);
getline(cin, name);
an error comes up underneath the first getline saying "Identifier not found"
I already have the code for the assignment below, but there is some errors in the code. Please help me fix them.
The assignment:
Make a telephone lookup program. Read a data set of 1,000 names and telephone numbers from a file that contains the numbers in random order. Handle lookups by name and also reverse lookups by phone number. Use a binary search for both lookups. This assignment needs a resource class and a driver class. The resource class and the driver class will be in two separate files. The resource class will contain all of the methods and the driver class only needs to call the methods. The driver class needs to have only 5 lines of code. The code needs to be written in Java. Please help me with exactly what I asked for help.
The code:
PhoneLookup.java
import java.io.FileReader;import java.io.IOException;import java.util.Scanner;
public class PhoneLookup{ public static void main(String[] args) throws IOException { Scanner in = new Scanner(System.in);…
Chapter 30 Solutions
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
Ch. 30.1 - Prob. 30.1.1CPCh. 30.2 - Prob. 30.2.1CPCh. 30.2 - Prob. 30.2.2CPCh. 30.2 - Prob. 30.2.3CPCh. 30.2 - Prob. 30.2.4CPCh. 30.3 - Prob. 30.3.1CPCh. 30.3 - Prob. 30.3.2CPCh. 30.3 - Prob. 30.3.3CPCh. 30.3 - Prob. 30.3.4CPCh. 30.3 - Given an array names in Listing 30.1, write the...
Ch. 30.4 - Prob. 30.4.1CPCh. 30.4 - How do you create a parallel stream?Ch. 30.4 - Prob. 30.4.3CPCh. 30.4 - Prob. 30.4.4CPCh. 30.4 - Prob. 30.4.5CPCh. 30.4 - Write a statement to obtain an array of 1000...Ch. 30.5 - Prob. 30.5.1CPCh. 30.5 - Prob. 30.5.2CPCh. 30.5 - Prob. 30.5.3CPCh. 30.5 - Prob. 30.5.4CPCh. 30.6 - Prob. 30.6.1CPCh. 30.7 - Prob. 30.7.1CPCh. 30.8 - Can the following code be used to replace line 19...Ch. 30.8 - Prob. 30.8.2CPCh. 30.8 - Prob. 30.8.3CPCh. 30.8 - Prob. 30.8.4CPCh. 30.8 - Write the code to obtain a one-dimensional array...Ch. 30 - Prob. 30.1PECh. 30 - Prob. 30.2PECh. 30 - Prob. 30.3PECh. 30 - (Print distinct numbers) Rewrite Programming...Ch. 30 - Prob. 30.5PECh. 30 - Prob. 30.6PECh. 30 - Prob. 30.7PECh. 30 - Prob. 30.8PECh. 30 - Prob. 30.9PECh. 30 - Prob. 30.10PECh. 30 - Prob. 30.11PECh. 30 - (Sum the digits in an integer) Rewrite Programming...Ch. 30 - (Count the letters in a string) Rewrite...Ch. 30 - Prob. 30.14PECh. 30 - (Display words in ascending alphabetical order)...Ch. 30 - Prob. 30.16PECh. 30 - Prob. 30.17PECh. 30 - (Count the occurrences of words in a text file)...Ch. 30 - (Summary information) Suppose the file test.txt...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
How many hello output lines does this program print?
Computer Systems: A Programmer's Perspective (3rd Edition)
For each of the following activities, give a PEAS description of the task environment and characterize it in te...
Artificial Intelligence: A Modern Approach
What C string will be stored in singingString after the following code is run? char singingString[20] = DoBeDo;...
Problem Solving with C++ (9th Edition)
Challenge exercise Modify the getLoginName method of Student so that it always generates a login name, even if ...
Objects First with Java: A Practical Introduction Using BlueJ (6th Edition)
Assuming that intNumber is an integer variable, what value will each of the following statements assign to it? ...
Starting Out With Visual Basic (8th Edition)
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
- In the expression 48:(14*3), are the brackets necessary? What happens when you type 48:14*3?arrow_forwardClean IDE, a function on Clean language.arrow_forwardDuring the sockets lab we cast the second parameter from a struct sockaddr_in to a struct sockaddr. struct sockaddr_in address; /* ... */ bind(server_fd, (struct sockaddr*)&address, sizeof(address)) This provides a limited form of polymorphism: bind only needs the first few fields of its struct, and both struct sockaddr_in and struct sockaddr have the same fields at those addresses. Consider the following example: typedef struct { float x; float y; float z; } point3D; typedef struct { float x; float y; } point2D; float distance(point2D *a1, point2D *a2) { /* ... */ } int main() { point2D a = { .x = 2.1, .y = 3.0 }; point3D b = { .x = 4.1, .y = 4.3, .z = 4.0 }; // Call distance function with a and b } How would you pass a and b to the distance function? If several work, pick one that will not create warnings. A. distance(a, b); B. distance(a, (point2D)b); C. distance(&a, &b); D. distance(&a, &(point2D)b); E. distance(&a, (point2D*)&b); F. none of…arrow_forward
- Regex, APIs, BeautifulSoup: python import requests, refrom pprint import pprintfrom bs4 import BeautifulSoup complete the missing bodies of the functions below: def mathmatic(target):"""Question 1You are doing fun math problems. Given a string of combination of '{}', '[]','()', you are required to return the substring included by the outermost '{}'.You need to write your code in one line.Args:target (str): the string to search inReturns:str>>> mathmatic('{[[[[]()]]]}')'[[[[]()]]]'>>> mathmatic('[(){([{}])}]')'([{}])'"""pass test code: # print(mathmatic('{[[[[]()]]]}'))# print(mathmatic('[(){([{}])}]'))arrow_forwardLinks Bing Remaining Time: 1 hour, 24 minutes, 17 seconds. * Question Completion Status: Р QUESTION 8 bbhosted.cuny.edu/webapps/assessment/take/launch.jsp?course_assessment_id=_2271631_1&course_id=_2 Implement the following: 1) Define a function evenList() with an arbitrary parameter a. P 2) This function accepts any number of integer arguments. 3) evenList() stores all even numbers into a list and returns the list. 4) Call the function with 5, 6, 7, 8, 9, 10 as arguments. 5) Print the result of the function call. Make sure to precisely match the output format below. Write your code in the ANSWER area provided below (must include comments if using code is not covered in the course). Example Output [6, 8, 10] For the toolbar, press ALT+F10 (PC) or ALT+FN+F10 (Mac). BIUS Paragraph Arial QUESTION 9 Programs s 10pt Click Save and Submit to save and submit. Click Save All Answers to save all answers. く Ev Avarrow_forwardExercise 11.4. ¤ Write a function in Python that takes two inputs: • a list of points in R", a positive integer d, and returns the degree-d least squares approximation to the input points. You may use the solve command from numpy.linalg or scipy.linalg.arrow_forward
- 167. Please help me answer both of these engineering questionsarrow_forwardLAB 7-4 WHal on your missing Oman 100.35, and-1 (the sentinel value). LAB 7-5 Desk-Check The code shown in Figure 7-45 should display the numbers 2, 4, 6, 8, 10, and 19 Desk-check the code. Did your desk-check reveal any errors in the code? If so. correct the code, and then desk-check it again. Your for (int number 2; number < 12; number += 2) %3D cout << number << endl; //end for cont 2 Figure 7-45 Code for Lab 7-5 192691 sunns The in this lab should display the averago Put the C++ in the proper and then or i instructions. Test the using the bills: 124.89, 110.65, 99.43, development tool, and view the file, is in the C++ tool, you may need to file first.) LAB 7-6 Debug Cpp8\Chap07\Lab7-4 Project or the oarrow_forwardC++: Using the code in image: 1. Write your own main and insert function to insert the sequence of integers { 138, 99, 16, 134, 42, 0, 6, 9, 4, 53, 47, 66) using a table of size 17. 2.Implement your own rehashing algorithm of choice and run the same sequence of input using a table of size 7.arrow_forward
- Evaluate the following functions: 1. prune [[[3],[1,2,4]],[[1,3],[3,4]]] 2. fix prune [[[5],[6,8]],[[7],[7,8]]] 3. blocked [[[3,4],[],[3]],[[1],[1,2],[1]]] 4. expand [[[1,2],[3]],[[4),[1,2]]arrow_forwardProblem Y: Implement the reader writer problem using pthreads and semaphores. You should allow multiple readers to read at the same time and only one single writer to write to the data set. You are required to use the following: 1. A semaphore rw_muter initialized to 1. 2. A semaphore muter initialized to 1. 3. An integer reader_count initialized to 0.arrow_forwardJava programming homework Please help me with question 13.30arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Call By Value & Call By Reference in C; Author: Neso Academy;https://www.youtube.com/watch?v=HEiPxjVR8CU;License: Standard YouTube License, CC-BY