09-01 Class Notes CS 107

09-01 Class Notes CS 107 - 09-01 Class Notes CS 107...

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

View Full Document Right Arrow Icon
Announcements: Note program #1 is due tomorrow before noon. Take a look at some of the nice Scratch programs already submitted. ACM: http://acm.cs.uic.edu/ $10 to join …. Just do it Other organizations: SHPE, SWE, IEEE, EDT, NSBE, Questions? Last Time: comments, variables Today: types, assignment, arithmetic, String concatenation, if statement Version 2 : Variables, assignment, arithmetic, string concatenation /** * Weight Calculator > Essentials2.java * * Displays your calculated weight on the moon using console output. * Illustrates variable declarations, identifiers, initialization, assignment, * arithmetic expression, string concatenation, escape sequences * * @author Dale Reed */ public class Essentials2 { public static void main(String[] args) { // variable declarations int earthWeight; // weight on the earth // Set the weight on earth. In the future we will get this from the user. earthWeight = 220; // time to go on a diet. .. // compute the result double moonweight; // weight on the moon moonweight = earthWeight * 0.15; //display the result System.out.print( "If on earth you weigh " + earthWeight + " pounds,"); System.out.println( " on the moon you'll weigh " + moonweight + " \n\n"); } } /* Output: If on earth you weigh 220 pounds, on the moon you'll weigh 33.0 */ Type Description Examples int double char 09-01 Class Notes CS 107 Wednesday, September 01, 2010 12:12 PM 107 Fall 2010 Page 1
Background image of page 1

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

View Full DocumentRight Arrow Icon
char boolean String -------------------------------------
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/10/2012 for the course COP 2271 taught by Professor Reed during the Fall '10 term at University of Central Florida.

Page1 / 4

09-01 Class Notes CS 107 - 09-01 Class Notes CS 107...

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

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