Computer Science 120 – Module 8: Strings Instructions Note: Although some reference is made within the lesson to a variety of built-in String methods in the String class, you will want to refer to the...

1 answer below »
This is Beginner Level Java, Please do not use any Advanced Code or Online Repositories. This is for a High School Level Class, I can not have any evidence of Plagiarism or Academic Dishonesty. I can send you my Previous Programs that I have Created so you can get a sense of what level of advancement I am on.


Computer Science 120 – Module 8: Strings Instructions Note: Although some reference is made within the lesson to a variety of built-in String methods in the String class, you will want to refer to the Java API for further information and clarification. In the real world, Java programmers refer to the Java API regularly to use built-in methods so that they are not always writing code from scratch. • Java API – link is in the NBVHS material • String page of the Java API – link is in the NBVHS material There are five parts to this assignment. Part I will be completed in a Word processing application. Make sure to number all questions. Parts II, III, IV and V will be completed in a text editor. Make sure to Save each file. When you have completed the assignment, you will have four java source files and one Word processing file. This assignment is marked out of 110. Part I Suppose that S1, S2 and S3 are three strings, given as follows: String S1 = “Welcome to Java”; String S2 = S1; String S3 = new String (“Welcome to Java”); 1. What are the results of the following expressions? Your answers should indicate what the output would be or what the expressions would evaluate to. (Each expression is worth one mark for a total of 21 marks). a. S1 == S2 b. S2 == S3 c. S1.equals(S2) d. S1.charAt (0) e. S1.indexOf ( ‘j’ ) f. S1.indexOf ( “to” ) g. S1.lastIndexOf ( ‘a’ ) h. S1.lastIndexOf ( “o”, 15 ) i. S1.length() j. S1.substring (5) k. S1.substring (5, 11)2 l. S2.equals (S3) m. S1.compareTo (S2) n. S2.compareTo (S3) o. S1.startsWith( “Wel” ) p. S1.endsWith ( “ Java“) q. S1.toLowerCase () r. S1.toUpperCase() s. S1.replace ( ‘o’, ‘T’ ) t. S1.replaceAll ( “o”, “T” ) u. S1.replaceFirst ( “o”, “T” ) 2. Suppose that S1 and S2 are two strings. Which of the following statements or expressions are incorrect? (Each statement/expression is worth one mark for a total of 9 marks) a. String S = new String ( “new string” ); b. String S3 = S1 + S2; c. String S3 = S1 – S2; d. S1 == S2; e. S1 >= S2; f. S1.compareTo (S2); g. int I = S1.length(); h. char c = S1 (0); i. char C = S1.CharAt (S1.length() ); Each of the following parts (Parts II, III, IV and V) are marked out of 20. • 15 points for running without errors and meeting criteria • 3 points for documentation: o program’s purpose o your information o code comments • 2 points for presentation and style Refer to the General Assignment Rubric to maximize your mark for these programming activities. Part II 1. Write a Java program to do the following in the main method: • Create an object from the String class that contains your first name. • Create an object from the String class that contains your last name. • Create an object from the String class that contains your middle name. • Display the total number of characters in your full name, including spaces between names. • Output something similar to "The total number of characters in my name is: 25".3 Part III 1. Write a Java application to do the following in the main method: • Ask the user for a name. • Store their answer in a variable of type String. • Ask the user for a second name. • Store their answer in a variable of type String. • Compare the two string variables to determine if the two names are equal: o If they are equal, display "The names are equal" o If they are not equal, display "The names are not equal" o Test your program with names that are the same and names that are different. Part IV Write a Java program that asks the user to input characters from the command line. Input will continue until the period (.) character is input alone, followed by “Enter”. At the end of the program, output the total number of characters (counting the period) that were input. For example: Hello th e re . Number of characters: 11 Part V Write a Java program that asks the user to enter characters, one at a time, from the command line. The program should end when the period (“.”) character is entered and the number of case changes that occurred should be displayed. As each character is entered, the program should: • Change each lowercase character to uppercase after it is entered • Change each uppercase character to lowercase after it is entered • Output the resulting change to the monitor after each character is input • Not make any changes to other characters such as @ or $ • Instruct the user to enter the period (.) character to end the program Submitting the Assignment Submit your completed assignment as follows: • Please do not zip your files. • Upload your files, one at a time, to the TEAMS Assignment section. There should be five files in the Assignment when you are finished. Computer Science 120 – Module 9: Arrays Instructions: There are three parts to this assignment. Each part will be done in a separate text editor file. Make sure to save each file. You will be submitting three text editor files when you are done. Note: To write these programs efficiently, variables must be used to represent an array index. For example: correct: gradeTable[x] incorrect: gradeTable[1], gradeTable[2], gradeTable[3], etc This assignment is marked out of 60. Each part is worth 20 points with the following breakdown: • 15 points for meeting the criteria • 3 points for documentation • 2 points for presentation and style Please see the General Assignment Rubric for more detail on how programming problems are marked. Part One Write a Java program that uses an array to find the average of 10 double values entered by the user. Part Two Write a program that accepts ten integers entered by the user and displays the integers in reverse order. Make sure your program uses arrays. Part Three Write a Java program that will fill a two-dimensional array table with numbers entered by the user. It should have 4 rows and 5 columns. Your program should do the following: • Ask the user to input 20 numbers, one at a time, from the command line. • Output the array table. • Output the average of all the numbers in each of the five columns This is an example of what the output could look like: Row 0: 1 2 3 4 5 Row 1: 2 3 4 5 6 Row 2:3 4 5 6 7 Row 3: 4 5 6 7 8 Average: 2.5 3.5 4.5 5.5 6.5 Submitting the Assignment Submit your completed assignment as follows: • Please do not zip your files. • Upload your files, one at a time, to TEAMS Assignments. There should be three Java text editor source files when you are finished.
Answered Same DayJun 01, 2021

Answer To: Computer Science 120 – Module 8: Strings Instructions Note: Although some reference is made within...

Nithin answered on Jun 02 2021
150 Votes
README
Documentation
1. Both the required files are zipped (Module8.zip and Module9.zip) as it’s n
ot
possible to upload as a complete folder, hence please extract the same before
submitting.
2. Inside each module you should see a folder named “src” under which all the
programs can be found.
3. Programs are named in such a way that you can easily...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here