Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please help me complete the extra credit for this program. Thanks Project2 java E3 1 package osu. Cse1223; 3 import java util. Scanner 5 public
Please help me complete the extra credit for this program.
Thanks
Project2 java E3 1 package osu. Cse1223; 3 import java util. Scanner 5 public class Project2 public static void main String args) 1 TODO Auto-generated method stub System. out.printlnC "Enter long string Scanner sc new Scanner System. in 10 11 String astr SC nextLine 12 System. out.printlnC"Enter sub string 13 String substr next 14 System. out.println "Length of string +astr length 15 System. out.println "Length of sub string :"+substr .lengthO); 16 int index astr. index0fCsubstr 17 String retu astr substringC index) 18 System. out.printlnCretu); 19 System. out. println C position of your substring in string "+index) "Starting 20 System. out. printlnC"String before your substring "+astr. substring(0 index-1)) 21 System. out.println "String after your substring substring index+substr.lengt 22 System. out.printlnC"Enter position between 0 and length()-1)) int i next IntO 24 System. out. printlnC Chatacter at position "+i+" is +astr char i)) 25 System. out.printlng"enter a replacement string 26 String rep sc.nextC); 27 28 System. out. printlnC"Your nes string is +astr. replaceAllCsubstr, rep)) 29 30 31 32 33 34 E Console 23
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