CECS 478 Lecture Notes - Lecture 4: Round-Off Error
Document Summary
You cannot assign a value to a constant. Making program more interactive: allow the inputs to be read from the users. Prompt for input by asking a question or a command: ex: please enter the number of nickels: what is your age? . System. out. print( what is your age? int age = in. nextint(); Example: system. out. print( enter # of nickels ); int numofnickels = in. nextint(); We have . 4 but we want . 40. . 4000000 = round-off error of floating-point #s: formatting output: Can change to %1. 2f: total amount: . 4.