CECS 478 Lecture Notes - Lecture 4: Round-Off Error

29 views1 pages

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.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents