0

A Little Database is Shorter with a Loop

 2 years ago
source link: http://programmingbydoing.com/a/a-little-database-is-shorter-with-a-loop.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
A Little Database is Shorter with a Loop
  • Author: Graham Mitchell
  • Filename: LilDatabaseLoop.java

A Little Database is Shorter with a Loop

Make a record to store information about a student, which should handle a name, a grade classification, and an average.

Create an array of type Student with three slots. Read in values for the three students and print them out again.

You must use a for loop.

U:\>java LilDatabaseLoop

Enter student 1's name: Esteban
Enter student 1's grade: 12
Enter student 1's average: 79.3

Enter student 2's name: Dave
Enter student 2's grade: 10
Enter student 2's average: 91

Enter student 3's name: Michelle
Enter student 3's grade: 11
Enter student 3's average: 98.6

The names are: Esteban Dave Michelle
The grades are: 12 10 11
The averages are: 79.3 91 98.6

©2013 Graham Mitchell

This assignment is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 United States License.
Creative Commons License


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK