Modify Programming Project 5 from Chapter 2 to check the validity of input data. Valid input is no less than 25 cents, no more than 100 cents, and an integer multiple of 5 cents. Compute the change only if a valid price is entered. Otherwise, print separate error messages for any of the following invalid inputs: a price under 25 cents, a price that is not an integer multiple of 5, and a price that is more than a dollar.
This project is a simple modification of Project 5 from Chapter 2. Three if statements are added to detect invalid input: less than 25 cents, more than a dollar, and not a multiple of 5 cents.
See the code in VendingChangeImproved.java.
You might also like to view...
MC Which type of databases store data in tables and define relationships between the tables?
a) tabular databases. b) relational databases. c) storage databases. d) None of above.
A program deletes a shared memory segment by using
A. shmdt B. shmctl
Visual literacy is the ability to examine and assess graphical elements.
Answer the following statement true (T) or false (F)
__________ are used to match specific character patterns in text. They can be used to val- idate data to ensure that it is in a particular format, to replace parts of one string with another, or to split a string.
Fill in the blank(s) with the appropriate word(s).