CS46A Fall 18

2A

Thanksgiving Day is November 22, 2018 this year.

Write a program DaysUntilPrinter which will calculate how many days from today (whatever day the program is run) until Thanksgiving Day.

Chapter 2 Worked Example 1 from your text gives you a Day class and discusses how to use it. A copy of the Day class itself is at the Codecheck URL below. You need to copy the class into a Bluej project along with the starter code.

Lesson 2 of the Horstmann videos also discusses the Day object. Section 19: How Many Days gives an example of working with the Day object in code.

Do the following:

For the draft, just add code to the starter to define the variable today and assign today's date to it. When you run the program, the date will be printed by the starter code.

 

2A draft:
2A final:

2B

Complete the class WorkingWithStrings class using String methods. Remember that all the String methods are accessors. They do not change the original String. If you want to apply multiple methods to a String, you will need to save the return value in a variable.

Complete the class by doing the following

You are given a word in the starter file and Codecheck will test with that word and with a different word. You should not worry about the other word. Codecheck will take care of it.

For the draft, add code to do the first two steps: The original word will be printed for you.

2B draft:
2B final:

2C

In this application you will finish the SnowmanViewer class. You will need the Horstmann graphics package. Download and unzip it if you have not done so. Put it in a convenient location. (You will need this again in future assignments and exams).The URL is https://s3.amazonaws.com/udacity-hosted-downloads/graphics.zip

Create a new Bluej project. Select Project->Import ... Navigate to the graphics folder, select it, and click Open to add it to your project. You may get a warning. Just click Continue. Be sure the folder you import contains the files directly and does not contain an extra folder. Your workbench should look similar to this.

workbench

 

Now create a new class, SnowmanViewer, and copy the starter code from Codecheck. Finish the application to draw a snowman consisting of 3 circles centered on top of one another with a hat on top. The centers of the circles fall on a vertical line. The drawing will looks like this:

screen shot of output

The dotted rectangle is the bounding rectangle of the middle circle. It is not part of your drawing.

Specifications:

For the draft, fill the hatbox and draw the brim.

You may get a warning. Just click Continue

2C draft:
2C final: