Question: Lab1: Write a class, xxxx StringLab1 (where xxxx is your Kean id), with a main method. Include th……

Lab1: Write a class, xxxx StringLab1 (where xxxx is your Kean id), with a main method. Include the following: (10 points) o o o o o Using the methods of String produce the output in the following slide You must use the methods indicated on the slide following the output This is an individual assignment Declare a String variable in your class. The content of the String is Kean University Using the String and the methods of the String class, print the following lines (you do not have to print the line numbers at the beginning of each line; they are there so I can show you want method I want you to use in the next section). On each line, you MUST use a method of the String you created to produce the output to receive any credit 1) The number of characters is 15 2) The String in lower case is kean university 3) The String in upper case is KEAN UNIVERSITY 4) The first 6 characters of the String is Kean U 5) The rest of the characters in the String are niversity 6) The U in the String is at position 5 7) The u in the String is at position-1 8) The o in the String is at position -1 9) A new String where University is replaced with U Kean U 10)The original String has not changed Kean University For each line use the methods to the right of the line: 1) The number of characters is 15 2) The String in lower case is kean university 3) The String in upper case is KEAN UNIVERSITY 4) The first 6 characters of the String is Kean U 5) The rest of the characters in the String are niversity (substring) 6) The U in the String is at position 5 7) The u in the String is at position -1 8) The o in the String is at position -1 9) A new String where University is replaced with U Kean U (replace) 10)The original String has not changed Kean University (none) (length) (toLowerCase) (toUpperCase) (substring) (indexof) (indexOf) (indexof)PLEASE FOLLOW ALL DIRECTIONS PROVIDED BY TEACHER

Lab1: Write a class, xxxx StringLab1 (where xxxx is your Kean id), with a main method. Include the following: (10 points) o o o o o Using the methods of String produce the output in the following slide You must use the methods indicated on the slide following the output This is an individual assignment Declare a String variable in your class. The content of the String is “Kean University” Using the String and the methods of the String class, print the following lines (you do not have to print the line numbers at the beginning of each line; they are there so I can show you want method I want you to use in the next section). On each line, you MUST use a method of the String you created to produce the output to receive any credit 1) The number of characters is 15 2) The String in lower case is kean university 3) The String in upper case is KEAN UNIVERSITY 4) The first 6 characters of the String is Kean U 5) The rest of the characters in the String are niversity 6) The U in the String is at position 5 7) The u in the String is at position-1 8) The o in the String is at position -1 9) A new String where University is replaced with U Kean U 10)The original String has not changed Kean University For each line use the methods to the right of the line: 1) The number of characters is 15 2) The String in lower case is kean university 3) The String in upper case is KEAN UNIVERSITY 4) The first 6 characters of the String is Kean U 5) The rest of the characters in the String are niversity (substring) 6) The U in the String is at position 5 7) The u in the String is at position -1 8) The o in the String is at position -1 9) A new String where University is replaced with U Kean U (replace) 10)The original String has not changed Kean University (none) (length) (toLowerCase) (toUpperCase) (substring) (indexof) (indexOf) (indexof)

Expert Answer

answers

But i have written the following program in Java with the use of String methods. Before that please find the below String methods in java which are used in the following program.

Don't use plagiarized sources. Get Your Custom Essay on
Question: Lab1: Write a class, xxxx StringLab1 (where xxxx is your Kean id), with a main method. Include th……
Get an essay WRITTEN FOR YOU, Plagiarism free, and by an EXPERT!
Order Essay

1. int length() – It returns count of total number of characters in the String.

2. String toLowerCase() – It returns the string in lowercase letter. In other words, it converts all characters of the string into lower case letter.

3. String toUpperCase() – It returns the string in uppercase letter. In other words, it converts all characters of the string into upper case letter.

4. String substring(0,6) – It returns the substring of the string starting index of 0 and ending index with 6. Note here it will not return you the character at 6th index. It will return string from 0 to 5th indices.

5. String  substring(6) – It will return substring of the string strting from index 6 until the end of the string.

67. & 8. int indexOf(‘U’) – It will return the index of the letter ‘U’. Note here that this will return first occurance of the character in the string.

It is case sensitive(treats ‘U’ and ‘u’ as different). If it not finds any occurance of the character then it reurns -1.

9. String replace(“University”,”U”) – It will return the new string which is replaced “Uniuversity” with letter “U”.

Program – class name is xxxx_StringLab1

public class xxxx_StringLab1 {

public static void main(String[] args) {

// Below will initalize the string variable str to Kean University

String str = “Kean University”;

//used length() to get the number of characters in the string

System.out.println(“The number of character is ” + str.length());

//used toLowerCase() to covert all the characters in the string to lower case

System.out.println(“The String in lower case is ” + str.toLowerCase());

//used toUpperCase() to covert all the characters in the string to upper case

System.out.println(“The String in upper case is ” + str.toUpperCase());

//used substring(0,6) to get first six characters of the string

System.out.println(“The first six characters of the string is “+str.substring(0, 6));

//used substring(0,6) to get remaining characters of the string

System.out.println(“The rest of the characters in the string are “+str.substring(6));

//used indexOf() to get the index of U

System.out.println(“The U in the string is at position “+str.indexOf(‘U’));

//used indexOf() to get the index of U

System.out.println(“The u in the string is at position “+str.indexOf(‘u’));

//used indexOf() to get the index of U

System.out.println(“The o in the string is at position “+str.indexOf(‘0’));

//used replace() to replace University with U

System.out.println(“The new String where University is replaced with U “+str.replace(“University”, “U”));

//Original String

System.out.println(“The Original String has not changed “+str);

}

}

Top Grade Homework
Order NOW For a 10% Discount!
Pages (550 words)
Approximate price: -

Why Work with Us

Top Quality and Well-Researched Papers

We always make sure that writers follow all your instructions precisely. You can choose your academic level: high school, college/university or professional, and we will assign a writer who has a respective degree.

Professional and Experienced Academic Writers

We have a team of professional writers with experience in academic and business writing. Many are native speakers and able to perform any task for which you need help.

Free Unlimited Revisions

If you think we missed something, send your order for a free revision. You have 10 days to submit the order for review after you have received the final document. You can do this yourself after logging into your personal account or by contacting our support.

Prompt Delivery and 100% Money-Back-Guarantee

All papers are always delivered on time. In case we need more time to master your paper, we may contact you regarding the deadline extension. In case you cannot provide us with more time, a 100% refund is guaranteed.

Original & Confidential

We use several writing tools checks to ensure that all documents you receive are free from plagiarism. Our editors carefully review all quotations in the text. We also promise maximum confidentiality in all of our services.

24/7 Customer Support

Our support agents are available 24 hours a day 7 days a week and committed to providing you with the best customer experience. Get in touch whenever you need any assistance.

Try it now!

Calculate the price of your order

Total price:
$0.00

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

Our Services

No need to work on your paper at night. Sleep tight, we will cover your back. We offer all kinds of writing services.

Essays

Essay Writing Service

No matter what kind of academic paper you need and how urgent you need it, you are welcome to choose your academic level and the type of your paper at an affordable price. We take care of all your paper needs and give a 24/7 customer care support system.

Admissions

Admission Essays & Business Writing Help

An admission essay is an essay or other written statement by a candidate, often a potential student enrolling in a college, university, or graduate school. You can be rest assurred that through our service we will write the best admission essay for you.

Reviews

Editing Support

Our academic writers and editors make the necessary changes to your paper so that it is polished. We also format your document by correctly quoting the sources and creating reference lists in the formats APA, Harvard, MLA, Chicago / Turabian.

Reviews

Revision Support

If you think your paper could be improved, you can request a review. In this case, your paper will be checked by the writer or assigned to an editor. You can use this option as many times as you see fit. This is free because we want you to be completely satisfied with the service offered.

× Contact Live Agents