Repeat Exercise 12 in Chapter 7, but use an instance of ArrayList instead of an array. Make the following slight changes to the methods to reflect that an ArrayList object can grow in size:

• Change the constructor’s parameter from the maximum degree to the desired degree.
• The method setConstant might need to add zero-valued coefficients before
ai. For example, if a0 = 3, a1 = 5, a2 = 0, a3 = 2, a4 = 0, and a5 = 0, the polynomial would be of degree 3, since the last nonzero constant is a3. The invocation setConstant(8, 15) would need to set a6 and a7 to 0 and a8 to 15.


See the code in Polynomial.java.

Computer Science & Information Technology

You might also like to view...

What is a potential disadvantage of running an update query?

What will be an ideal response?

Computer Science & Information Technology

A customer would like to upgrade their onboard fast Ethernet connection to connect to their new gigabit network at the gigabit speed. Which of the following will enable them to do so?

A. Convert the user to wireless. B. Install a 10/100/1000 NIC. C. Update the drivers for the onboard port. D. Flash the BIOS to unlock the Ethernet port.

Computer Science & Information Technology

Which tool enables you to find out how much memory a particular application is using?

A. Msconfig B. Task Manager C. Chkdsk D. System Information

Computer Science & Information Technology

Answer the following statements true (T) or false (F)

1. The use of named constants makes an algorithm more flexible. 2. A detail line is usually written after the loop is exited. 3. A heading line serves as a title to a report that is output. 4. The priming read is usually placed as the first step within the loop. 5. The loop read in a loop controlled using trailer record logic is usually placed as the last step in the loop.

Computer Science & Information Technology