Home Segments Top Top Previous Next

30: Mainline

Suppose, for example, that you want to compute the overall rating of a movie, given integers that specify individual ratings for the script, acting, and direction. For the moment, assume each individual rating contributes equally to the total rating. In Java, your program will contain a simple summing expression:

6 + 9 + 8