![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]()
![]()
(chat, newsreader, calendar)
|
![]() |
|
Course Notes Table of Contents | Exercises JDBC Short Course Index | Online Training Index
|
Selecting |
Working Applet | Help Solution
|
PrerequisitesSkeleton CodeThis exercise results in an application that displays a cumulative grade graph for the students at MageLang University. The database contains a single table that contains the names, classes, and grades of all the students. You will need to convert the "A"-"B"-"C" style grades to the numerical equivalence before averaging the grades for the report's graph. To create the bar chart of the students' average gradess, use the NetCharts package from NetFactory. After the initial setup, the next several tasks should be familiar. These tasks will not be listed in full later.
Perform the following tasks:
Copy the odbc.datasource file from the previous exercise. Load the sun.jdbc.odbc.JdbcOdbcDriver class. Create a Connection to the DriverManager. Create a Statement to perform the query. Execute a query to select everything from the students table and get the results. Find out in which columns the name, class, and grade fields are located. Generate a bar chart from the results. A helper routine, showChartData, is provided, which requires two comma-delimited strings. The first, names, is a list of names, while the other, averages, is a list of their averages. You need to keep each individual's entries at the same position in each list. Note: The names and averages variables in the skeleton are StringBuffer variables, not String for performance reasons. StringBuffer.append is much quicker than using the "+" with Strings.
|
Copyright © 1997 MageLang Institute. All Rights Reserved May-97 Copyright © 1996, 1997 Sun Microsystems Inc. All Rights Reserved |