|
|||||||||||||||
Example: | |||||||||||||||
This program reads a percentage value from the user (such as 5.5) and converts to the correct decimal equivalent (such as 0.055) by using the division assignment operator. | |||||||||||||||
import java.util.*; import java.io.*; public class AppStr // Variable for holding a percentage entered by the user // Prompt for and read the percentage System.out.print(“Enter a percentage in n.nn format: “); percent = Keyboard.nextDouble(); |