RU beehive logo ITEC Department logo
ITEC 120
2007spring
ibarland,
jpittges

homeinfoexamslectureslabshws
RecipeLawsliessyntaxjava.lang docsjava.util docs

hw00
hw00
Introductions; finger exercises

Due Date: Jan.15 (Mon.)16 (Tue, post-MLK day), 17:00. 1

Instructions:

  1. (nickname, 1pt) What name do you prefer to go by?
  2. (major, 1pt) What is your major, and how confident are you of this? (give a number in [0,1]—so 50% means you're giving even odds on whether you'll graduate with that as your major).
  3. (faveCourse, 1pt) Out of the other courses you are taking this semester, which one is shaping up to be the most interesting?
  4. (fave, 1pt) Write down a category (in object-oriented terms, a “class,”), and a most-favorite or least-favorite instance of that class. (For example: “My favorite powerpuff girl: Buttercup.” or “Class: Musical genres; Least favorite instance: Polka.”)
  5. (Blackboard, 1pt) Post your previous answer to the class Discussion Board, in Blackboard.
  6. (learning style, 3pts) Take the Index of Learning Styles Questionnaire.
    What are your four scores? (e.g. “ACT 5, INT 2, …”. Be sure to include the name with each number; if you only write “5”, I can't tell if you mean “ACT 5” or “REF 5”.)
  7. (0pts) In Blackboard, you'll find a passel of ITEC120 courses listed: a class and lab (L) entry for your particular section, plus a class and lab entry “ITEC120-Barland (All Sections)” or “ITEC120-Pittges (All Sections)”. We will only use the All Sections class. The other three Blackboard entries will just clutter your Blackboard view for the semester, unless you click on the pencil icon in the upper-right of your list, and choose to "Hide Link" for other ITEC120 entries.
  8. (5pts) What do each of the following Java expressions evaluate to?
    Before typing them in, think to yourself what you think the answer should be; feel free to note if any surprising or puzzling results.
    1. 2+3*4
    2. 2+(3*4)
    3. (2+3)*4
    4. 12.0 / 5.0
    5. 12 / 5
    6. 12 % 5
    7. Math.sqrt(25) (the built-in function Math.sqrt returns the square-root of a number)
    8. Math.sqrt( 3*3 + 4*4 )
    9. Math.sqrt( Math.sqrt(16) )
    10. Math.sqrt( Math.abs(-16) ) (the built-in function Math.abs returns the absolute value of a number)
    Notice how, in the last three examples, you compute an intermediate result, and then pass that result as an input to another function (the (outermost) Math.sqrt).
  9. (2pts) Java has function (method) which raises one number to another. Look at the documentation for class Math, and find it. (Hint: Alphabetically, it's between “max” and “signum”; the method summaries, closer to the top of the page, are listed alphabetically.)
    Write a java expression3 computing 220 (a.k.a. 1 Meg — a bit over a million), using this function.
  10. (5pts) What do each of the following Java snippets evaluate to? (Give a value, or the error message produced.)
    1. 2+3)
    2. 2--5
    3. 2 - - 5 (note the spaces)
    4. Write “two minus negative five” more clearly than either of the above attempts.
    5. 4 / 0
    6. Math.sqrt(-4.0)
    7. Math.log(0)
    8. Math.log(0) / Math.log(0)
    9. Math.log(-1)
    10. 10000000.0 (seven zeroes before the decimal point — ten million)

1But you are expected to finish homeworks over the weekend and bring them to class on Monday morning; the 17:00 deadline is there in case you run in to unexpected snags, there is still a chance to come to office hours before the due-date.      

2You could even use BlueJ's editor, if you like.      

3I'm asking for the expression, not the numeric result.      

homeinfoexamslectureslabshws
RecipeLawsliessyntaxjava.lang docsjava.util docs


©2007, Ian Barland, Radford University
Last modified 2007.Aug.27 (Mon)
Please mail any suggestions
(incl. typos, broken links)
to iba�rlandrad�ford.edu
Powered by PLT Scheme