FinalReviewSession

FinalReviewSession - FINAL REVIEW SESSION Odometer What you...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
FINAL REVIEW SESSION Odometer What you are going to do is write a program that is going to simulate an odometer by creating an array that will hold the 7 integers, with each element holding a digit from the odometer. You are responsible for writing two methods, each its own subproblem. For both problems you can assume that it will always be an array of 7 ints. Part A The first method is an odometerString method, which will create a String based on the contents of the integer array. Thus if we were to call odometerString with the contents from the array shown above, the string returned would be. "5,339.9" There are a couple of things to notice here: they are: 1) no leading zeroes were included in the String. (but if the odometer has less than a mile, the string formed should have at least two places, ie “0.0” 2) There is a decimal point inserted to correctly represent the tenths place 3) There is a comma to separate the thousands place, and that should be added as well. Part B
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/18/2010 for the course CS 106A taught by Professor Sahami,m during the Fall '08 term at Stanford.

Page1 / 3

FinalReviewSession - FINAL REVIEW SESSION Odometer What you...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online