Answered step by step
Verified Expert Solution
Question
1 Approved Answer
please follow the detailed instruction of the professor Fill in the blanks in the program below as follows: (Section 3.2, especially the example in Listing
please follow the detailed instruction of the professor
Fill in the blanks in the program below as follows: (Section 3.2, especially the example in Listing 3.1, should be helpful): (a) declare the variable town as a reference to a String object and initialize it to "Baltimore, MD" (no spaces before the B or after the D). (b) write an assignment statement that invokes the length method of the String class to find the length of the college String object and assigns the result to the stringLength variable (c) complete the assignment statement so that changel contains the same characters as college but all in upper case. (d) complete the assignment statement so that change2 is the same as changel except all capital C's are replaced with the asterisk (*) character. (e) complete the assignment statement so that change3 is the concatenation of college and town (use the concat method of the String class rather than the t operator). (f) test the code. i / / pare (a) int stringlength; String change1, change2, change 3 ; System, out,println (college + " contains " + stringlength + " characters." ); change1 = System. out.println (change1): change 2= System. out.printin (change2): change 3 = ; /l part (e) System.out.printin ("The final string is " + change 3 ); Play with String objects public class StringPlay / public static void main (String [] args) ( String college = new String ("CCBC - Catonsville Campus"); int stringlength; ; I part (a) string change1, change2, change3; change 1= contains " + stringlength + " characters."); system. out. printin (changel); ; / / part (c) change 2 = System. out.println (change2): change 3= System. out. println ("The final string is " + change 3 ); 1 tal possible points: 5 points (one point each part) CCBC - Catonsvi11e Campus contains 25 characters. CCBC - CATONSVILLE CAMPUS BATONSVILLE *AMPUS The final string is CCBC - Catonsville CampusBaltimore, MD Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started