Question: 1. Write a java program to iterate over characters of a string to replace every occurrence of 'm' with a star based on the following
1. Write a java program to iterate over characters of a string to replace every occurrence of 'm' with a star based on the following requirements: a. Ask the user to enter any string (2 marks) b. Use a for loop in your program (4 marks) C. Please do not use any methods and libraries that have not been discussed in our lectures. d. The program should print the number of characters that have been replaced. (2 marks) e. The program should print the new string (2 marks) Sample output: Please enter your String: I would love to improve my programming skills The number of characters that have been changed is: 4 The new string is: I would love to i*prove my progra**ing skills Please enter your String: I will take Business Intelligence very soon The number of characters that have been changed is: 0 The new string is: I will take Business Intelligence very soon
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
