JMU logo

Sample Specification 

Specification:
Read in a number representing the day of the year as a double(1.0 - 365.0), convert it to an int and print it back out.  When printing output use 2 decimal place precision for outputting doubles.

Given these input and output files. Make sure you do a diff on the outputs to make sure they match exactly.

testing.in and testing.exp

Methods:
Write a method readNumber that returns a double and has a parameter of String type for a prompt to the user.

Main:
Call your readNumber method and save the result into an int variable then print out the output as an int.


Video walk-through for solution.

Solution: Testing.java


Contact chaoaj[at]jmu.edu for more information about this page or Twitter: @chaoaj