{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

09-feb18

# 09-feb18 - COMP110 MoreLoopsandStrings TabithaPeckM.S...

This preview shows pages 1–7. Sign up to view the full content.

COMP 110 More Loops and Strings Tabitha Peck M.S. February 18, 2008 MWF 3-3:50 pm Philips 367 1

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

View Full Document
Announcements Programs START EARLY!!!! Should take 10-15 hours Should NOT take 20+ hours Get help if you are stumped Office hours are helpful Read Instructions 2
Announcements Program 2 Format to 2 decimal places Convert floating point numbers to integers for modular arithmetic String parsing Comments and pseudocode 3

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

View Full Document
Program 2 Grades 101% - 110% 9 90% - 100% 13 80% - 89% 5 70% - 79% 2 0% - 69% 2
Formatting Decimals (Jan 30) import java.text.*; DecimalFormat df = new DecimalFormat( "0.00" ); df.format(myVariable); Example code on class website 5

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

View Full Document
import java.text.DecimalFormat; public class DecFormat { public static void main(String[] args) { DecimalFormat df = new DecimalFormat("0.00"); DecimalFormat df2 = new DecimalFormat("0.0000"); double d = 12.345678; System.out.println("my double with two decimal places: " + df.format(d)); System.out.println("my double with four decimal places: " + df2.format(d)); } } 6
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 19

09-feb18 - COMP110 MoreLoopsandStrings TabithaPeckM.S...

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

View Full Document
Ask a homework question - tutors are online