SE1011
Homework
This is an old version of this course, from Fall 2014. A newer version is available here.
Week 1
Write the problem number for each problem you do. You can skip the optional problems. For example, you might only solve problems 1.1, 1.3, and 2, for the first HW assignment.
- Due start of class 2
- Choose any file on your computer. Right-click on the file and select "Properties"
- Write the name of the file and its size measured in bytes.
- (Optional) What is the size of the file measured in KB (Kibibytes/Kilobytes) or MB (Mebibytes/Megabytes)? What do these units mean?
- Write whether this file stored on your hard-disk, in memory, or on the CPU. (A full sentence is not required.)
- Press the keys <CTL>-<Alt>-<Delete> all at the same time. This will bring up a blue screen with a few options. Click on "Start Task Manager." This will bring up the task manager for your computer. On the Performance tab, you can see CPU usage and Memory usage. Write these down for your computer.
- (Optional) In the processes tab of the Task Manager is a list of all the programs running on your computer. Pick a process. Write its name, and the amount of memory it is using. Write whether this memory is larger or smaller than the file you selected earlier.
- (Optional) Can your hard-drive hold more, or your memory? Do you think there are any computers with the opposite?
- Choose any file on your computer. Right-click on the file and select "Properties"
- Due start of class 3
- On paper, write an algorithm to compute the volume of a Sphere
- On paper, write a Java program for 1. You do not need to write the imports, class, or public static void main(String[] ignored), just the stuff inside it.
- Due start of class 1, week 2
- In IntelliJ, make two errors at compile time. Write the errors that IntelliJ gives you and explain why you received them.
- In intelliJ, make an error at runtime. Write the error message you receive. Explain why you received it.
- Due end of Week 1
- Meet Dr. Yoder in his office or for lunch
- (Optional) Due beginning of Lab Week 1
- Download and install Java Development Kit (JDK) 7.
- Or from Here
- Download and install IntelliJ IDEA 13 (Community Edition).
- Due Week 2, end of class 2
Three-ring binder withnotes as described in The Course Overview (If you have multiple subjects, I can do a quick review after class, so you can keep your notebook.)
Week 5
Complete in codingbat (You do not need to turn in any paper). Due at start of class (but you can modify your solution if you have a question about it.)
- CodingBat: makeAbba (optional)
- CodingBat: alarmClock (optional)
- CodingBat: closeFar
- CodingBat: starOut
- CodingBat: sumDigits(optional)
- CodingBat: middleThree(Optional)
- CodingBat: makeChocolate (Optional)
- Exercise: 4.9, 5.5 (optional)
- Project: 4.2, 5.2 (optional)
Complete in Codingbat. Due at start of class, Tuesday of Week 5
Complete in Codingbat. Due at start of lab, Wednesday of Week 5
- CodingBat: sameStarChar
- CodingBat: countCode (optional)
Week 6
Do on paper, and turn in in class
- Due at the start of class, Friday of Week 6
- Write the constructor method shown in the UML diagram as
+Complex(real:double)
- Complete the toString method shown in the UML diagram as
+toString():String
. Rewrite the method so that it displays the negative complex numbers with a minus sign instead of a plus sign between the parts. e.g. Instead of1.0 + i-3.0
, the method should print1.0 - i3.0
. (It should still represent other complex numbers in the original format.) - (Optional) In the complex class, we used
this.real = real;
to avoid the problem of assigning the parameter back to itself (real = real
.) Can you think of another way to solve the problem? - (Optional) Write the
plus
method that we will implement on Friday. Rememer, this method should create a new object which represents the sum ofthis
object and the objectcomp
that is passed in.
- Write the constructor method shown in the UML diagram as
- Due at the start of class, Monday of Week 7
- For the following program, draw a memory diagram using the format we use in class at each letter comment (e.g.
// a.
) in the program snippet below. Assume the program uses the Dragster class we developed in class. You only need to draw the velocity instance variables, not the other instance variables in the class (And you can abbreviate the names!). Also draw the local variables in main and all of the reference arrows. Be sure to provide the name (if it has one) and type of each variable and object.public static void main(String[] ignored) { Dragster red = new Dragster(); Dragster blue = null; red.setVelocityMetersPerSecond(200); // a. blue = red; // b. blue.setVelocityMetersPerSecond(10); // c. red.step(1); blue.step(1); System.out.println("Red: " + red.getPositionMeters()+ " m"); System.out.println("Blue: " + blue.getPositionMeters()+ " m"); }
- What will be printed by the two lines at the end of the program in part 1?
- (Optional) How would you fix the program so that it does what the user expects?
- For the following program, draw a memory diagram using the format we use in class at each letter comment (e.g.
Last modified: Thursday, 05-Sep-2013 08:41:31 CDT