2A
In this problem you will use various String methods. Complete the class StringPrinter
replace is an accessor method. It returns the changed version of the string. If you want to do something with the returned string - like use replace on it again - you need to save the return value in a variable.You must use the String replace method on strings of one character. No credit for simply printing the word with replacements or replacing the entire word.
For the draft, just print twice the length of the string. Note:: There is a String method length() which returns the length of the String
Note: When you submit your code to Codecheck, it will first run with the given word(separate) but then it will run again with a different word. You do not need to worry about that. It will happen automatically. If your code is correct, the second word will also execute correctly.
2B
Winter Solstice is on December 21 this year. The winter solstice is officially the first day of winter in the Northern Hemisphere. It is also the shortest day of the year (has the fewest daylight hours).You will complete the application SolsticePrinter.
Do the following:
today and assign today's date to it. Use the no-argument constructor. 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 will be the current date.For the draft, just define the variable today and assign today's date to it. Use the no-argument constructor.
2C
Finish the class TrafficLightViewer. Draw a black rectangle at (50, 20) with a width of 20 and a height of 60. Then fill red, yellow, and green circles inside the rectangle to look like a traffic light. The upper left hand corner of the red circle will also be at (50, 20). You figure out the other locations and the diameters. The circles will touch the sides of the box and each other.
Use the predefined colors Color.RED, Color.YELLOW, and Color.GREEN.
Draw in this order: rectangle, red circle, yellow circle, green circle.
Your finished image will look like this.

For the draft, draw the box and the top circle (the red one). Be sure to use fill for the circle