All Matches
Solution Library
Expert Answer
Textbooks
Search Textbook questions, tutors and Books
Oops, something went wrong!
Change your search query and then try again
Toggle navigation
FREE Trial
S
Books
FREE
Tutors
Study Help
Expert Questions
Accounting
General Management
Mathematics
Finance
Organizational Behaviour
Law
Physics
Operating System
Management Leadership
Sociology
Programming
Marketing
Database
Computer Network
Economics
Textbooks Solutions
Accounting
Managerial Accounting
Management Leadership
Cost Accounting
Statistics
Business Law
Corporate Finance
Finance
Economics
Auditing
Hire a Tutor
AI Study Help
New
Search
Search
Sign In
Register
study help
computer science
introduction to java programming and data structure
Questions and Answers of
Introduction to Java Programming and Data Structure
Write a program that converts a red-black tree to a 2-4 tree.
Rewrite Programming Exercise 33.13 using RMI. You need to define a remote interface for sending and receiving a message.
Use the three-tier approach to modify Programming Exercise 40.4, as follows:■ Create a JavaFX client to manipulate student information, as shown in Figure 33.23a. ■ Create a remote object
Write a program named Exercise36_11Writer that writes 1307 * 16 Chinese Unicode characters starting from \u0E00 to a file named Exercise36_11.gb using the GBK encoding scheme. Output 16 characters
Write an HTML form that prompts the user to enter loan amount, interest rate, and number of years, as shown in Figure 37.28a. Clicking the Compute Loan Payment button invokes a servlet to compute and
Write a servlet that displays the student name and the current score, given the SSN and class ID. For each class, a text file is used to store the student name, SSN, and current score. The file is
Rewrite Exercise 37.7 using servlets.Data from Exercise 37.7Rewrite the preceding servlet. Assume for each class, a table is used to store the student name, ssn, and score. The table name is the same
Write a JSP program that displays a country's flag and description as shown in Figure 38.12. The country code such as us is passed as a parameter in the URL. The country's flag file is named as
Rewrite Programming Exercise 33.1 using RMI. You need to define a remote interface for computing monthly payment and total payment.Data from Programming Exercise 33.1Write a server for a client. The
Rewrite Programming Exercise 33.6 using RMI. You need to define a remote interface for adding addresses and retrieving address information.Data from Programming Exercise 33.6Develop a client/server
Suppose that the scores are stored in the Scores table. The table was created as follows:create table Scores (name varchar(20),score number, permission boolean);insert into Scores values (‘John’,
Rewrite Listing 16.13, ImageAudioAnimation.java, to use the resource bundle to retrieve image and audio files. (Hint: When a new country is selected, set an appropriate locale for it. Have your
Write a server for a client. The client sends the weight and height for a person to the server (see Figure 33.18a). The server computes BMI (Body Mass Index) and sends back to the client a string
Modify the example for displaying a calendar in Section 36.3.6, “Example: Displaying a Calendar,” to localize the labels “Choose a locale” and “Calendar Demo” in French, German, Chinese,
Modify Listing 31.12, TabPaneDemo.java, to add a pane of radio buttons for specifying the tab placement of the tab pane, as shown in Figure 31.57b and c.Data from Listing 31.12,Listing 31.12
Rewrite Programming Exercise 20.1 using streams.Data from Programming Exercise 20.1Write a program that reads words from a text file and displays all the words (duplicates allowed) in ascending
Rewrite Programming Exercise 7.17 using streams. Define a class named Student with data fields name and score and their getter methods. Store each student in a Student object.Data from Programming
Rewrite Programming Exercise 7.15 using streams and sort the elements in the new array in increasing order.Data from Programming Exercise 7.15Write a method that returns a new array by eliminating
Rewrite Programming Exercise 7.8 using streams.Data from Programming Exercise 7.8Write two overloaded methods that return the average of an array with the following headers:public static double
Rewrite Programming Exercise 7.7 using streams.Data from Programming Exercise 7.7Write a program that generates 100 random integers between 0 and 9 and displays the count for each number. (Hint: Use
Rewrite Programming Exercise 7.4 using streams.Data from Programming Exercise 7.4Write a program that reads an unspecified number of scores and determines how many scores are above or equal to the
Suppose that the TreeNode class defined in BST contains a reference to the node’s parent, as shown in Exercise 26.17. Implement the RBTree class to support this change. Write a test program that
Write a GUI program that animates the red-black tree insert, delete, and search methods, as shown in Figure 43.6. Dant D Red-Black Tree Animatio x + + c o
Redefine Tree24Node to add a reference to a node’s parent, as shown below:Add the following two new methods in Tree24:public Tree24Node<E> getParent(Tree24Node<E> node)Returns the
Write a JSF that prompts the user to enter a capital for a state, as shown in Figure 39.34a. Upon receiving the user input, the program reports whether the answer is correct, as shown in Figure
Write a JSP for Exercise 33.1, as shown in Figure 38.17.Data from Exercise 33.1,Write a server for a client. The client sends loan information (annual interest rate, number of years, and loan amount)
Rewrite Exercise 39.1 to handle large factorial as shown in Figure 39.32. Use the BigInteger class introduced in Section 10.9.Data from Exercise 39.1Write a JSF page that displays a factorial page as
Rewrite Listing 38.11 to handle a large factorial. Use the BigInteger class introduced in §14.12.Data from Listing 38.11 package chapter38: 2 3 1mport java.text.: 4 5 publ 1c class NewFactorialBean
Write a JSP that prompts the user to enter a capital for a state, as shown in Figure 38.16a. Upon receiving the user input, the program reports whether the answer is correct, as shown in Figure
Write a test class to test the methods getBMI and getStatus in the BMI class in Listing 10.4.Data from Listing 10.4. 1 publ1c class BMI { private String name: private int age: private double weight:
Write a test class to test the method isPrime in Listing 6.7 PrimeNumberMethod. java.Data from Listing 6.7 1 public class PrimeNumber Method { 2 pub11c static void main(String[] args) {
Write a test class to test the methods add, remove, addAll, removeAll, size, isEmpty, and contains in the java.util.HashSet class.
Write a test class to test the methods length, charAt, substring, and indexOf in the java.lang.String class.
Write a program that converts a red-black tree to a 2-4 tree.
Design and implement a class for B-trees.
Write a GUI program that animates the 2–4 tree insert, delete, and search methods, as shown in Figure 42.4. Tree m 0 Tree24 The root of the tree. The size of the tree. - root: Tree24Node +size: int
Write a GUI program that displays a 2–4 tree.
The iterator method in Tree24 is left as an exercise. Implement it to iterate the elements using inorder.
The postorder method in Tree24 is left as an exercise. Implement it.
The inorder method in Tree24 is left as an exercise. Implement it.
The user needs to answer all five questions before clicking the Submit button in the Quiz application in Section 41.6, Web Service Session Tracking. A runtime error will occur if a radio button is
Write a Web service with a method named getCount() that returns the number of the times this method has been invoked from a client. Use a session to store the count variable.
You can compute a loan payment for a loan with the specified amount, the number of years, and the annual interest rate. Write a Web service with two remote methods for computing monthly payment and
Revise the preceding exercise so that the findScore method returns –1 if permission is false. Add an another method named getPermission(String name) that returns 1, 0, or –1. The method returns 1
Modify the TicTacToe example in Section 40.6, “RMI Callbacks,” as follows:■ Allow a client to connect to the server as an observer to watch the game. ■ Rewrite the Cell class as a
Rewrite Programming Exercise 40.4. Assume that the address is stored in a table.Data from Exercise 40.4,Rewrite Programming Exercise 33.6 using RMI. You need to define a remote interface for adding
Modify the example in Section 40.3.1, “Example: Retrieving Student Scores from an RMI Server,” to limit the number of concurrent clients to 10.
Write a program that displays the day of the week for a given day,month, and year, as shown in Figure 39.39. The program lets the user select aday, month, and year, and click the Get Day of Week
Write a JSP page that generates a random number between 1 and 1000 and let the user enter a guess. When the user enters a guess, the program should tell the user whether the guess is correct, too
Write a JSP program that generates subtraction quizzes randomly, as shown in Figure 38.14a. The first number must always be greater than or equal to the second number. After the user answers all
The Poll table in Exercise 37.13 contains only one question. Suppose you have a Poll table that contains multiple questions. Write a JSP that reads all the questions from the table and display them
Rewrite Exercise 37.13 using JSP.Data from Exercise 37.13Write a Java servlet for Exercise 33.1, as shown in Figure 37.34. Exercse37_13- Mozilo Firefer 回x Ee E yew Hetory Bookmaks Iook Heb
Rewrite Exercise 37.12 using JSP.Data from Exercise 37.12Create an HTML form that prompts the user to enter a Java program in a text area, as shown in Figure 37.33a. The form invokes a servlet that
Rewrite Exercise 37.11 using JSP. Use Cookie[]cookies = request.getCookies() to get all cookies.Data from Exercise 37.11Write a servlet that displays all the cookies on the client. Theclient
Rewrite Exercise 37.10 using JSP. Use response. addCookie(Cookie) to add a cookie.Data from Exercise 37.10Write a servlet that stores the following cookies in a browser, and set their max age for two
Rewrite Exercise 37.8 using servlets.Data from Exercise 37.8Write a servlet that enables the user to change the password from an HTML form, as shown in Figure 37.30a. Suppose the user information is
Rewrite Exercise 37.6 using servlets.Data from Exercise 37.6Write a servlet that displays the student name and the current score, given the SSN and class ID. For each class, a text file is used to
Rewrite Exercise 37.4 using JSP. You need to import ComputeTax in the JSP.Data from Exercise 37.4Write an HTML form to prompt the user to enter taxable income and filing status, as shown in Figure
Rewrite the servlet in Listing 37.4, GetParameters.java, using JSP. Create an HTML form that is identical to Student_Registration_Form. html in Listing 37.3 except that the action is replaced by
Rewrite Exercise 37.2 using JSP.Data from Exercise 37.2Write a servlet to display a multiplication table, as shown in Figure 37.25b. leate e teanvete ju 36. (b)
Rewrite Exercise 37.1 using JSP.Data from Exercise 37.1Write a servlet to display a table that contains factorials for the numbers from 0 to 10, as shown in Figure 37.25. Na 36 401 (a) (b)
Create an HTML form that prompts the user to answer a question such as “Are you a CS major?”, as shown in Figure 37.35a. When the Submit button is clicked, the servlet increases the Yes or No
Write a Java servlet for Exercise 33.1, as shown in Figure 37.34.Data from Exercise 33.1,Write a server for a client. The client sends loan information (annual interest rate, number of years, and
Create an HTML form that prompts the user to enter a Java program in a text area, as shown in Figure 37.33a. The form invokes a servlet that displays the Java source code in a syntax-highlighted HTML
Write a servlet that displays all the cookies on the client. Theclient types the URL of the servlet from the browser to display all the cookies stored on the browser. (see Figure 37.32.)
Write a servlet that stores the following cookies in a browser, and set their max age for two days.Cookie 1: name is “color” and value is red.Cookie 2: name is “radius” and value is
Write an HTML form that prompts the user to enter or select a JDBC driver, database URL, username, password, and table name, as shown in Figure 37.31a. Clicking the Submit button displays the table
Write a servlet that enables the user to change the password from an HTML form, as shown in Figure 37.30a. Suppose the user information is stored in a database table named Account with three columns:
Rewrite the preceding servlet. Assume for each class, a table is used to store the student name, ssn, and score. The table name is the same as the class ID. For instance, if the class ID were
form to prompt the user to enter taxable income and filing status, as shown in Figure 37.27a. Clicking the Compute Tax button invokes a servlet to compute and display the tax, as shown in Figure
Develop a servlet that displays the number of visits on the servlet. Also display the client’s host name and IP address, as shown in Figure 37.26. Exercise37_03a - Mozila Firefox Edit Vew History
Write a servlet to display a multiplication table, as shown in Figure 37.25b. Exercse37 02 Maa irefox D DM ew D ts Db Exerase3 02 bcahost tpterervtroncTa o Google Mahipication Talde 16 18 18 21 24 16
Write a servlet to display a table that contains factorials for the numbers from 0 to 10, as shown in Figure 37.25. Otoorch_02-Ma et V oret y be ot p t trates pTertesoteesbe e B- Meky ta 12 36 16 20
Rewrite Exercise 5.8 to display at most two digits after the decimal point for the temperature using the DecimalFormat class.Data from Exercise 5.8Write a program that prompts the user to enter the
Rewrite Listing 2.8, ComputeLoan.java, to display the monthly payment and total payment in currencyData from Listing 2.8, 1 1mport java.util.Scanner: 2 3 publ1c class SalesTax ( publ1c static void
Write a program that converts U.S. dollars to Canadian dollars, German marks, and British pounds, as shown in Figure 36.18. The user enters the U.S. dollar amount and the conversion rate, and clicks
Rewrite Exercise 4.22 using JavaFX, as shown in Figure 36.17. The program allows the user to set the loan amount, loan Exercseso 0s trer Loan Arour, Nunber of rears, and Anua trterest Rate Display
Write two programs to display the available locales and time zone IDs using buttons, as shown in Figure 36.16. Exercise36_04 America/Phoenix Armerica /Port-au-Prince America/Port_of_Spain
Write a program that displays the current date in a calendar and current time in a clock, as shown in Figure 36.15. Enable the program to run standalone. CH Exercise36_03 August 2013 Sunday Monday
Write a program that displays the current date and time as shown in Figure 36.14. The program enables the user to select a locale, time zone, date style, and time style from the combo boxes.
Develop a GUI application that displays Unicode characters, as shown in Figure 36.13. The user specifies a Unicode in the text field and presses the Enter key to display a sequence of Unicode
Rewrite Listing 35.1, SQLClient.java, to display the query result in a TableView, as shown in Figure 35.8. Exercise35 05 trter Daabese infomton tter an S comand select from Enroiment DeC Drver
Write a program that fills in table names in a combo box, as shown in Figure 35.7b. You can select a table from the combo box to display its contents in a table view. |Exercise35_04 回X Table Name
Write a program that uses the buttons First, Next, Prior, Last, Insert, Delete, and Update, and modify a single record in the Address table, as shown in Figure 35.6. Exerdse35_02 iprtate MI C Delete
Write a program that inserts a thousand records to a database, and compare the performance with and without batch updates, as shown in Figure 35.5a. Suppose the table is defined as
Suppose the database contains a student table defined as follows:A full name is in the form of firstname mi lastname or firstname lastname. For example, John K Smith is a full name. Write a program
Write a program that views, inserts, and updates staff information stored in a database, as shown in Figure 34.27a. The View button displays a record with a specified ID. The Insert button inserts a
Develop a client/server application to view and add addresses, as shown in Figure 33.20. Exercise33 06Client Name loh Smith Street 100 Main Street City Savannah State GA Zip 31412 Add First Nest
Modify Listing 22.11, EightQueens.java, to display the intermediate results of the search. As shown in Figure 32.33, the current row being searched is highlighted. Every one second, a new state of
Modify Programming Exercise 22.21 to display the intermediate results of the search. Figure 32.32 gives a snapshot of an animation in progress with number 2 placed in the cell in Figure 32.32a,
Write a program that creates two priority queues, {"George", "Jim", "John", "Blake", "Kevin", "Michael"} and {"George", "Katie", "Kevin", "Michelle", "Ryan"} and displays their union, difference, and
Define a new class named BSTWithBFT that extends BST with the following method:/** Display the nodes in a breadth-first traversal */public void breadthFirstTraversal()Use
Section 22.8 introduced an algorithm for finding a closest pair of points in O(nlogn) time using a divide-and-conquer approach. The algorithm was implemented using recursion with a lot of overhead.
Rewrite Programming Exercise 7.1 using streamsData from Programming Exercise 7.1Write a program that reads student scores, gets the best score, and then assigns grades based on the following
Rewrite Programming Exercise 7.3 using streams.Data from Programming Exercise 7.3Write a program that reads the integers between 1 and 100 and counts the occurrences of each. Assume the input ends
Rewrite Programming Exercise 7.5 using streams. Display the numbers in increasing order.Data from Programming Exercise 7.5Write a program that reads in 10 numbers and displays the number of distinct
Rewrite Programming Exercise 7.9 using streams.Data from Programming Exercise 7.9Write a method that finds the smallest element in an array of double values using the following header:public static
Write a program that prompts the user to enter a binary number in string and displays its decimal value. Use Stream’s reduce method to convert a binary number to decimal.
Write a program that prompts the user to enter a hex number in string and displays its decimal value. Use Stream’s reduce method to convert a hex number to decimal.
Rewrite Programming Exercise 6.2 using streams. Data from Programming Exercise 6.2Write a method that computes the sum of the digits in an integer. Use the following method header:public static
Showing 1 - 100
of 347
1
2
3
4