Java Reference
In-Depth Information
7 Averaging Grades
Write a Java program that allows you to enter your grades in this course into an
array of floats. At the beginning of the program, the application should prompt
you for the total number of grades you intend to enter. After entering the grades,
the application should call a method to average the grades. Display the grades
and the resulting average.
Java 2
Java 2
v 5 . 0
8 Using Layout Managers
v 5 . 0
Figures 5-22 through 5-26 on pages 343 through 346 display the five different
layout managers available with Java's setLayout() method. Choose one of the
five, other than BorderLayout, and create the interface using Button compo-
nents. The components do not need to function, merely display. Print a copy of
the source code and hand it in to your instructor. Use static imports as described
on page 348.
9 Celebration Movies
Celebration Movies wants an application that allows the user to choose one of
six movies and then a number of tickets from drop-down lists. The application
should display a check box for users to click so that they can receive a discount if
they are purchasing tickets for matinee movies. After selecting the options, the
user should be able to click a Calculate Cost button to instruct the application to
display the total cost.
10 Using the Web
Using a Web search engine, enter the keywords, Java applets Choice(), to surf the
Web looking for examples of Java applets that use drop-down lists. If the source
code is not given, use your browser's View menu to look at the source code for
the applet. Print the source code and write comments for each line of code
describing what the code does, how the drop-down lists are populated, and how
the user's choices are evaluated.
11 Preventative Maintenance Schedules
The Pace Trucking Company has hired you to improve its maintenance tracking.
After a certain combination of miles and engine hours, truck engines are
required to have preventative maintenance. The trucking company would like a
program that allows the user to enter the truck's data and then display which
maintenance schedule should be performed. After the program asks for the
number of trucks to enter, users will enter the cab number, engine hours, and
mileage into arrays. Use a loop to go back through the array, checking the hours
or miles. If the engine hours are greater than 250 or the miles driven greater than
6,000, then the program should display the cab number and the words, Mainte-
nance Schedule A. If the hours are greater than 500 or the miles greater than
12,000, the program should display the cab number and the words, Maintenance
Schedule B. Trucks with more than 1,000 engine hours or 24,000 miles should
display the cab number and the words, Maintenance Schedule C.
Search WWH ::




Custom Search