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:
Day
object representing the current day. Use the constructor that does not take any parameters, like this. new Day()
today
. There is already a statement in the starter file to print the variable today
. Do not change it. Note that no matter when the application is run, the value in today
should be the current date. That means do not put any parameters in the parentheses for the Day constructor.Day
object representing Thanksgiving Day and assign it to a variable.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.
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.
2C
In this application you will finish theSnowmanViewer
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.
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:
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