Week 2 Homework

This conference area is for you to post your answer to one of the homework 2 problems. Then respond to at least one post of your classmates (mandatory) to encourage shared learning experience among all members.

All students are required to work on exercises 2.2, 2.6, 2.9, 2,25.

2.2 - The purpose of indentation is to provide readability in programs and "indicates that the indented material is a component of the material that preceded it."

 

2.6 - See below

a) issquare - no

i) Temperature - Yes/Class identifier

q) setBoundary - Yes/Variable

b) IsSquare - YES - class identifier

j) getToken - Yes/variable

r) sendMessage - Yes/Variable

c) is_square - No

k) get_Token - No

s) ThisColor - Yes/Class identifier

d) Square - Yes/Class identifier

l) _getToken - No

t) plametType - Yes/variable

e) mySquare - Yes/Variable

m) gettoken - No

u) PlanetValue - Yes/Class identifier

f) BigSquare - Yes/Class identifier

n) Token - Yes/Class Identifier

v) planet - yes/variable

g) fillSquare - Yes/variable

o) walking - Yes/variable

w) CurrentTime - Yes/Class Identifier

h) temperature - Yes/variable

p) Drawing - Yes/Class identifier

x) MyName - Yes/Class identifier

 

p.37 "....the identifier name of a variable be descriptive of the represented value and that it begin with a lowercase letter."

*methods can also start with lowercase letters like variables.

 

2.9 -

//Purpose: print a line of text

//File: question2point9.java

 

public class question2point9 {

     public static void main(String[] args) {

         System.out.println("Hi-dee-ho daddy-o");

     }

}

 

2.25 -

public class wk2question2pt25 {

   public static void main (String[] args) {

      int a = 10;

      int b = 20;

      int c = 30;

      int d = 40;

      int storage;

 

      storage = b;  //20

      b = a;             //10

      a = d;             //40

      d = c;             //30

      c = storage;  //20

 

      System.out.println (a);

      System.out.println (b);

      System.out.println (c);

      System.out.println (d);

 

   } // end method main

} // end class wk2question2pt25

 

In addition, you need to choose one from the following problems:

 

Add parentheses to the following so that the term 4+7 is multiplied by 3-8.

Parentheses ( ) in red are added.

 

2.18a) 7 * ( ( 4 + 7) * ( 3 - 8 ) ) * 2

2.18b) 12 - ( 4 + 7 ) * ( 3 - 8 ) - 5

2.18c) ( 4 + 7 ) * ( 3 - 8 ) - 12

 

2.5 a-i; 2.14 a-f; 2.15 a-f; 2.17; 2.18; 2.19 a-d; 2.20

 

Send me email

Visit my website

 


 

Home | Photos | Favorite Links | Matt's Bio

UMUC | Feedback | Guest book | E-mail me

 

FaulknerWeb.com is designed and managed by Matt Faulkner

Domain Name service provided by Namesecure

Web Service by eDataRack
Copyright © 1998 - 2009 [FaulknerWeb.com]. All rights reserved.
Updated: June 16, 2009 09:35 .