6. Modify/enhance the program. Make the following modifications to
enhance the program. See the window captures of the finished program
below for examples of program inputs and output.
7. Mod 1. Add a DVD counter and display a number for each DVD.
1. Add a DVD counter variable that increments when the information
on each DVD is input by the user.
2. Use this counter to number the DVDs as they are added to the
output string for display. Each line should start with the DVD number.
8. Mod 2. Add a category capability and display results.
a. Declare a variable to hold the category of the current DVD being input
by the user.
b. Add a JOptionPane dialog to present the list of categories and to enable
the user to select a category. See the window capture below for the list of
categories that your dialog must present.
c. The user must be able to just enter the number of his/her desired
d. As in Exercise 1, your code must convert the string returned by the
JOptionPane showInputDialog method. That is, the showInputDialog
method returns a string comprised of the users input. Your program must
include the extra code needed to convert the string comprised of the users
input from data type String to data type int.
e. You must then write a switch statement that will convert from the
integer number to the full name of the category. The integer number
resulting from the above step should be used as the control variable for the
switch statement.
f. Add the full name of the category for each DVD, with the explanatory
label Category: , as part of the output display string.
g. That is, continue to display the information on each DVD on one line,
with each DVD on a separate line. Each line must include the label
Category: followed by the name of the DVDs category.
9. Mod 3. Add a total cost accumulator and display the accumulated
total cost.
a. Add a total cost variable to keep an accumulating total of the cost of
all the DVDs entered by the user. This total cost must be incremented
during each pass through the main loop by the value of the new DVD being
entered during the particular pass through the loop.
b. Add this total cost to the output string during each pass through the
main loop and have it displayed on each DVD row of the display.