2A
Complete the class StringMethods
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
I made a mistake when doing the draft for this problem so I am changing the directions to match what is expected. See below. (Feb 9, 2016)
For the draft, print the word in lowercase and then print the original word. Leave the code where I print the original word.
2B
This problem originally asked for Cinco de Mayo. I made a mistake in my solution. When you create the second object, use May 1 and then it will pass Codecheck. My apologies for having to create Uno de Mayo rather than Cinco de Mayo. (Changed Feb 2, 2016)
In this problem you will complete an application to calculate how many days are left until May Day on May 1, 2016. Use the Day class presented in the Udacity. It is in Codecheck as well
Here is the set up.
cs46a/homeworks/hw02/draft
folder. You can call it hw2b_cinco_draft
Day
in the project and copy in the Day code from Codecheck. You will not modify this class at all.DaysLeftPrinter
in the project and copy in the code from Codecheck. This is where you will add your code.Now you are ready to do the assignment. In the main method:
Day
object representing the current day and assign it to a variable, today . You do that by using the new Day() constructor with nothing in the parentheses. (See the Day API). That will create a Day
object with today's date. You will get a different object if you run the program again tomorrow.Day
object representing May Day. This object will be the same every time you run the program. Day
using this statementDay
class to do thisFor the draft: Create a Day
object representing the current day and assign it to a variable named today. (Don't change the print statement)
When you are ready to work on the final, copy the Bluej project hw2b_cinco_draft
into the cs46a/homeworks/hw02/final
folder. Change the word draft to final. Open the project hw2b_cinco_final
in Bluej and complete the assignment.
2C
Draw the word COAT using the Line and Ellipse class from the Udacity graphics package. Download and unzip the graphics packages 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 like this.
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 and the O. (You will fill the O in the final version)
Sample output: