CS46A Spring 18

2A

Valentine's Day is February 14, 2018.

Write a program DaysUntilPrinter which will calculate how many days from today (whatever day the program is run) until Valentine's 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 Udacity 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 LeetMaker 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 set of letters

For the draft, just print the word in lowercase. The original word will be printed for you.

2B draft:
2B final:

2C

In this problem, you will draw the word COAT using the Line and Ellipse class from the Udacity graphics package. Download and unzip the graphics package if you have not done so. The URL is in the syllabus area of Canvas.

Create a new Bluej project. Select Project->Import ... Navigate to the graphics files and add to your project. 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

Create a class called CoatViewer in the project. Add a main method to the class. There is no starter file this time

Your drawing should follow these specifications. The code goes in the main method.

It is a good idea to figure out the coordinates of each letter before starting to draw. Trial and error is not efficient here.

For the draft, draw the C

Sample output for final version:

hw2c screenshot

2C draft:
2C final: