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
Ask a Question
Search
Search
Sign In
Register
study help
Computer science
java programming
big java, enhanced early objects
Questions and Answers of
Big Java, Enhanced Early Objects
Make an XML document describing a book, with child elements for the author name, the title, and the publication year.
Add a description of the book’s language to the document of Exercise • R25.5. Should you use an element or an attribute?Data from exercise R25.5 Make an XML document describing a book, with
What is mixed content? What problems does it cause?
Design an XML document that describes a purse containing three quarters, a dime, and two nickels.
Explain why a paint program, such as Microsoft Paint, is a WYSIWYG program that is also “what you see is all you’ve got”.
Consider the XML fileWhat are the values of the following XPath expressions?a. /purse/coin[1]/valueb. /purse/coin[2]amec. /purse/coin[2]ame/@langd. name(/purse/coin[2]/*[1])e. count(/purse/coin)f.
With the XML file of Exercise •• R25.10 , give XPath expressions that yielda. the value of the first coin.b. the number of coins.c. the name of the first child element of the first coin
Harry Hopeless doesn’t want to build a DOM tree to produce an XML document.Instead, he uses the following code: System.out.println(" "); for (LineItem anItem: items) { Product p =
Design a DTD that describes a bank with bank accounts.
Design a DTD that describes a library patron who has checked out a set of books.Each book has an ID number, an author, and a title. The patron has a name and telephone number.
Write the DTD file for the following XML document Comtrade Tornado 2495 60 AMAX Powerstation 75 2999 62
Design a DTD for invoices, as described in How To 25.3.Data from how to 25.3 Rams 1 3. LESENE 2212 HOW TO 25.3 Writing a DTD You write a DTD to describe a set of XML documents of the same type. The
Design a DTD for simple English sentences, as described in Special Topic 25.1.Data from special topic 25.1 Special Topic 25.1 Grammars, Parsers, and Compilers Grammars are very important in many
Design a DTD for arithmetic expressions, as described in Special Topic 25.1.Data from special topic 25.1 Special Topic 25.1 Grammars, Parsers, and Compilers Grammars are very important in many areas
Write a program that can read XML files, such as: 0.5 half dollar Your program should construct a Purse object and print the total value of the coins in the purse.
Building on Exercise •• E25.1 , make the program read an XML file as described in that exercise. Then print an XML file of the form Data from exercise E25.1 Write a program that can read XML
Repeat Exercise •• E25.1 , using a DTD for validation.Data from exercise E25.1 Write a program that can read XML files, such as: 0.5 half dollar Your program should construct a Purse object and
Write a program that can read XML files, such as:Your program should construct a Bank object and print the total value of the balances in the accounts. 3 1295.32
Repeat Exercise •• E25.4 , using a DTD for validation.Data from exercise E25.4 Write a program that can read XML files, such as: 3 1295.32
Enhance Exercise •• E25.4 as follows: First read the XML file in, then add ten percent interest to all accounts, and write an XML file that contains the increased account balances.Data
Write a DTD file that describes documents that contain information about countries: name of the country, its population, and its area. Create an XML file that has five different countries. The DTD
Write a parser to parse invoices using the invoice structure described in How To 25.1. The parser should parse the XML file into an Invoice object and print out the invoice in the format used in
Modify Exercise •• P25.2 to support separate shipping and billing addresses. Supply a modified DTD with your solution.Data from exercise P25.2Write a parser to parse invoices using the invoice
Write a document builder that turns an invoice object, as defined in Chapter 12, into an XML file of the format described in How To 25.2.Data from how to 25.2 M cars C HOW TO 25.2 Writing an XML
Modify Exercise •• P25.4 to support separate shipping and billing addresses.Data from exercise P25.4Write a document builder that turns an invoice object, as defined in Chapter 12, into an XML
Write a program that can read an XML document of the form 5 10 20 30 and draw the shape in a window.
Write a program that can read an XML document of the form 5 10 20 30 and draw the shape in a window.
Write a program that can read an XML document of the form 5 10 20 30 Support shape attributes "rectangle", "round rectangle", and "ellipse". Draw the shape in a window.
Write a program that can read an XML document of the form 5 10 and draw the shape in a window.
Write a program that can read an XML document of the form 5 10 20 30 5 10 25 40 Hello, World! 20 30 and show the drawing in a window.
Repeat Exercise ••• Graphics P25.10, using a DTD for validation.Data from Exercise P25.10Write a program that can read an XML document of the form: 5 10 20 30 5 10 25 40 Hello, World! 20 30
Following Exercise P12.2 , design an XML format for the appointments in an appointment calendar. Write a program that first reads in a file with appointments, then another file of the formatData from
Modify the LargestInArray.java program in Section 7.3.10 to mark both the smallest and the largest elements.
Add a method removeMin to the student class of Section 7.4 that removes the minimum score without calling other methods.Data from section 7.4
Write a method that implements the algorithm developed in Section 7.5.Data from section 7.5Manipulating physical objects can give you ideas for discovering algorithms.
Write a class DataSet that stores a number of values of type double. Provide a constructor public DataSet(int maximumNumberOfValues) and a method public void add(double value) that adds a value,
Consider the following class:public class Sequence{private int[] values;public Sequence(int size) { values = new int[size]; }public void set(int i, int n) { values[i] = n; }public int get(int i) {
Add a method public Sequence sum (Sequence other) to the Sequence class of Exercise •• E7.12 that yields the sum of this sequence and another. If the sequences don’t have the same length,
Add a method to the Table class below that computes the average of the neighbors of a table element in the eight directions shown in Figure 15:public double neighborAverage(int row, int
Given the Table class of Exercise •• E7.17 , add a method that returns the sum of the ith row (if horizontal is true) or column (if horizontal is false):public double sum(int i, boolean
Improve the program of Exercise •• E7.19 to work correctly when the data set contains negative values.Data from Exercise E 7.19Write a program that reads a sequence of input values and displays a
Improve the program of Exercise •• E7.19 by adding captions for each bar. Prompt the user for the captions and data values. The output should look like this:Egypt **********************France
Consider the following class: public class Sequence{private ArrayList values;public Sequence() { values = new ArrayList(); }public void add(int n) { values.add(n); }public String toString() { return
Add a method public Sequence merge(Sequence other) to the Sequence class of Exercise • E7.23 that merges two sequences, alternating elements from both sequences. If one sequence is shorter than the
Add a method public Sequence mergeSorted(Sequence other) to the Sequence class of Exercise • E7.23 that merges two sorted sequences, producing a new sorted sequence. Keep an index into each
A smartphone keeps track of the x- and y-position of a person once per minute. Use this data to solve a vexing problem: Where did the person last park their car? Look for positions that indicate a
In this assignment, you will implement a simulation of a popular casino game usually called video poker. The card deck contains 52 cards, 13 of each suit. At the beginning of the game, the deck is
A pet shop wants to give a discount to its clients if they buy one or more pets and at least five other items. The discount is equal to 20 percent of the cost of the other items, but not the pets.Use
Generate the image of a checkerboard.
Implement a class Cloud that contains an array list of Point2D.Double objects. Support methods:Draw each point as a tiny circle. Write a graphical application that draws a cloud of 100 random points.
Implement a class Polygon that contains an array list of Point2D.Double objects. Sup port methods:Draw the polygon by joining adjacent points with a line, and then closing it up by joining the end
Write a class Chart with methods: public void add(int value) public void draw (Graphics2D g2) that displays a stick chart of the added values, like this: You may assume that the values are pixel
Write a class BarChart with methods:that displays a bar chart of the added values. You may assume that all added values are positive. Stretch the bars so that they fill the entire area of the screen.
Write a class PieChart with methods:that displays a pie chart of the added values. Assume that all data values are positive. public void add(double value) public void draw (Graphics2D g2)
Consider a car share system in which drivers pick up other riders, enabling them to make money during their commute while reducing traffic congestion. Riders wait at pickup points, are dropped off at
Suppose you want to design a social network for internship projects at your university.Students can register their skills and availability. Project sponsors describe projects, required skills,
Your task is to write a program that simulates a vending machine. Users select a product and provide payment. If the payment is sufficient to cover the purchase price of the product, the product is
Your task is to write a program that reads a customer’s name and address, followed by a sequence of purchased items and their prices, and prints an invoice.Discuss which of the following would be
Your task is to write a program that computes paychecks. Employees are paid an hourly rate for each hour worked; how ever, if they worked more than 40 hours per week, they are paid at 150 percent of
Look at the public interface of the java.lang.System class and discuss whether or not it is cohesive.••
Suppose an Invoice object contains descriptions of the products ordered, and the billing and shipping addresses of the customer. Draw a UML diagram showing the dependencies between the classes
Suppose a vending machine contains products, and users insert coins into the vending machine to purchase products. Draw a UML diagram showing the dependen cies between the classes VendingMachine,
On which classes does the class Integer in the standard library depend?••
On which classes does the class Rectangle in the standard library depend?•
Classify the methods of the class Scanner that are used in this book as accessors and mutators.•
Classify the methods of the class Rectangle as accessors and mutators.•
Which of the following classes are immutable?a. Rectangleb. Stringc. Random•
Which of the following classes are immutable?a. PrintStreamb. Datec. Integer•••
Consider a method:Describe the side effects of the read method. Which of them are not recommended, according to Section 8.2.4? Which redesign eliminates the unwanted side effect?What is the effect of
What side effect, if any, do the following three methods have?public class Coin:••• { } public public void print () System.out.println(name + } } public void print (PrintStream stream) {
Ideally, a method should have no side effects. Can you write a program in which no method has a side effect? Would such a program be useful?••
How can you write a method that swaps two floating-point numbers?java.awt.Point.••
Draw a memory diagram that shows why the following method can’t swap two BankAccount objects:• public static void falseSwap(BankAccount a, BankAccount b) { } BankAccount temp = a; a = b; b temp;
Consider an enhancement of the Die class of Chapter 6 with a static variable• public class Die { private int sides; private static Random generator = new Random(); public Die(int s) {...} public
Try compiling the following program. Explain the error message that you get.• public class Print13 { } public void print(int x) { System.out.println(x); } public static void main (String[] args) {
Look at the methods in the Integer class. Which are static? Why?••
Look at the methods in the String class (but ignore the ones that take an argument of type char[]). Which are static? Why?••
Suppose you are asked to find all words in which no letter is repeated from a list of words. What simpler problem could you try first?••
You need to write a program for DNA analysis that checks whether a substring of one string is contained in another string. What simpler problem can you solve first?••
Consider the task of finding numbers in a string. For example, the string “In 1987, a typical personal computer cost $3,000 and had 512 kilobytes of RAM.” has three numbers. Break this task down
Is a Java program without import statements limited to using the default and java.lang packages?•
Suppose your homework assignments are located in the directory /home/me/cs101 (c:\Users\Me\cs101 on Windows). Your instructor tells you to place your homework into packages. In which directory do
Consider the task of fully justifying a paragraph of text to a target length, by putting as many words as possible on each line and evenly distributing extra spaces so that each line has the target
The in and out variables of the System class are public static variables of the System class. Is that good design? If not, how could you improve on it?••
Every Java program can be rewritten to avoid import statements. Explain how, and rewrite RectangleComponent.java from Section 2.9.3 to avoid import statements.•
What does JUnit do when a test method throws an exception? Try it out and report your findings.
Implement the Coin class described in Section 8.2. Modify the CashRegister class so that coins can be added to the cash register, by supplying a method:The caller needs to invoke this method multiple
Modify the giveChange method of the CashRegister class so that it returns the number of coins of a particular type to return:The caller needs to invoke this method for each coin type, in decreasing
Real cash registers can handle both bills and coins. Design a single class that expresses the commonality of these concepts. Redesign the CashRegister class and provide a method for entering payments
As pointed out in Section 8.2.3, the Scanner.next method is a mutator that returns a value. Implement a class Reader that reads from System.in and does not suffer from that shortcoming. Provide
Reimplement the BankAccount class so that it is immutable. The deposit and withdraw methods need to return new BankAccount objects with the appropriate balance.•
Reimplement the Day class of Worked Example 2.1 to be mutable. Change the methods addDays, nextDay, and previousDay to mutate the implicit parameter and to return void. Also change the demonstration
Write static methods:that compute the volume and surface area of a cube with height h, sphere with radius r, a cylinder with circular base with radius r and height h, and a cone with circular base
Modify the application of How To 7.1 so that it can deal with multiple students.First, ask the user for all student names. Then read in the scores for all quizzes, prompting for the score of each
Repeat Exercise ••• E8.9 , using multiple classes. Provide a GradeBook class that collects objects of type Student.Data from Exercise E8.9Modify the application of How To 7.1 so that it can
Write methods:that compute the area and the perimeter of the ellipsee. Add these methods to a class Geometry. The chal lenging part of this assignment is to find and implement an accurate formula for
Write methods:that compute the angle between the x-axis and the line joining two points, measured in degrees, and the slope of that line. Add the methods to the class Geometry. Supply suitable
Write methods:that test whether a point is inside or on the boundary of an ellipse. Add the methods to the class Geometry.•• public static boolean isInside (Point2D.Double p, Ellipse2D.Double e)
Using the Picture class from Worked Example 6.2, write a method:that superimposes two pictures, yielding a picture whose width and height are the larger of the widths and heights of pic1 and pic2. In
Using the Picture class from Worked Example 6.2, write a method:that superimposes two pictures, yielding a picture whose width and height are the larger of the widths and heights of pic1 and pic2. In
Showing 400 - 500
of 791
1
2
3
4
5
6
7
8