Sample Methods file

This file is a rewrite of the Convert class in pg 43 of Think Java.  It now conforms to our Checkstyle guide.

Sample 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. and testing.exp

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

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.


Back to Top