Java Reference
In-Depth Information
change = change % DIME;
//Step 9
System.out.println("The number of nickels to be "
+ "returned is "
+ change / NICKEL);
//Step 10
change = change % NICKEL;
//Step 11
System.out.println("The number of pennies to be "
+ "returned is " + change);
//Step 12
}
}
Sample Run: (In this sample run, the user input is shaded.)
Enter the change in cents: 583
The change you entered is 583
The number of half dollars to be returned is 11
The number of quarters to be returned is 1
The number of dimes to be returned is 0
The number of nickels to be returned is 1
The number of pennies to be returned is 3
QUICK REVIEW
1 . A Java program is a collection of classes.
2 . Every Java application program has a method called main .
3 . A single-line comment starts with the pair of symbols // anywhere in the
line. Multiple-line comments are enclosed between /* and */.
4 . The compiler ignores comments.
5 . In Java, identifiers are names of things.
6 . A Java identifier consists of letters, digits, the underscore character (_), and
the dollar sign ( $ ) and must begin with a letter, underscore, or the dollar sign.
7 . Reserved words cannot be used as identifiers in a program.
8 . All reserved words in Java consist of lowercase letters (see Appendix A).
9 . Java is case sensitive.
10 . A data type is a set of values with a set of operations.
11 . The three categories of primitive data types are integral, floating-point, and
Boolean.
12 . Integral data types are used to deal with integers.
13 . There are five categories of integral data types— char , byte , short , int ,
and long .
 
 
Search WWH ::




Custom Search