Help converting doubles to integers...
I'm currently in a Java programming class and stuck on an assginment.
The assignment asks me to do the following:
Write a program that:
a. Prompts the user to input five decimal numbers.
b. Prints the five decimal numbers.
c. Converts each decimal number to the nearest integer.
d. Adds the five integers.
e. Prints the sum and average of the integers.
I did part a and b with no problem but theres nothing in the chapter we're covering that talks about converting decimal numbers to the nearest integer (i.e. if it's 3.3 round it down to 3 and if it's 3.6 round it up to 4). If I can figure out part c then I can finish the rest of it.
There is a small section on type conversion (casting) in the chapter but it only talks about how it works, no examples of code or how to use casting.
Any help is appreciated
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center