September 30 0 Output: -------------------- September S M T W T F S -------------------- 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 -------------------- January 31 4 Output: -------------------- January S M T W T F S -------------------- 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 --------------------You may do the month names, lines, and list of weekday caps using String literals. The rest should be created using loops/conditionals. I will not give full credit for using separate loops for each week. Note that if the month starts on Thursday, the date 1 is lined up with the Thursday column, with leading spaces to move it over. Note that the dates are lined up in columns so that the 1-digit dates line up with the 1's digit of the 2-digit dates. Do not mess up the values in any instance variables while doing this!
Add a method String chainprint(), which if the month's next is null, reutrns just the month's toString, and otherwise, returns the month's toString + a call to the next's chainprint() (Yes, we are being recursive.)
Part B
In a class with a main, create a year of calendars by creating a january and then using makeNext on each month. (We dont have arrays yet, so create 12 separate variables.
Make sure that you can chainprint the whole and partial year.
// outer loop -- keep going for 10 rows, from 0 to 9 for (i = 0; i < 10; i++) { // inner loop -- print stars across row // start off at 10-i = 10-0 = 10 stars on row 0 // end up with 10-i = 10-9 = 1 star on row 9 for (j = i; j < 10; j++) { System.out.print("* "); // print one star+space } System.out.println(); // new line at end of row }prints this:
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *Here are two patterns. +25 EC for writing code in a main program to produce each pattern. For credit, your program must use loops to generate the patterns; no credit will be given for simply printing the lines literally.
PATTERN 1 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * PATTERN 2 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *(hint: more than one for loop could be involved in drawing one horizontal line in the pattern)
Create a class CompanyDoc, representing an official document used by a company. Give it a String title and an int length.
Throughout the class, use the this. notation rather than bare instance variables and method calls.
Add a default constructor. By default, documents should be length 0. Add a parameterized constructor that takes a value for title. Use this( appropriately to call one constructor from another.Employment Turnover Report (16342)Add a method longer( with return type boolean, which takes a CompanyDoc as parameter. doc1.longer(doc2) returns true if doc1's length is greater than doc2's length, false otherwise. Part B