PLEASE HELP asap 60 POINTS
needs to be in Java

A programmer has written a method called replaceLetter that counts the amount of times a letter is present in a word. Your job is to modify this existing method to fulfill a new purpose.

Rather than count the instances of a letter in a String, write a program that replaces all instance of one letter with another. You should directly modify replaceLetter to get this program to work. In the starter code, replaceLetter only has two parameter values. Your new version should have a third parameter to indicate which String value is replacing the existing letter.

For example,

replaceLetter("hello", "l", "y")
returns

"heyyo"
Sample output:

Enter your word:
hello

Enter the letter you want to replace:
l

Enter the replacing letter:
x
hexxo
Hint: The letters will be assigned from the user as String values. Make sure to use String methods to compare them!

Answers

Answer 1

import java.util.Scanner;

public class JavaApplication45 {

   public static String replaceLetter(String txt, String txt1, String txt2 ){

       char one = txt1.charAt(0);

       char two = txt2.charAt(0);

       String newTxt = "";

       for (int i = 0; i < txt.length(); i++){

           char c = txt.charAt(i);

           if (c == one){

               newTxt += two;

           }

           else{

               newTxt += c;

           }

       }

       return newTxt;

   }

   public static void main(String[] args) {

       Scanner scan = new Scanner(System.in);

       System.out.println("Enter your word:");

       String word = scan.nextLine();

       System.out.println("Enter the letter you want to replace:");

       String txt1 = scan.next();

       System.out.println("Enter the replacing letter:");

       String txt2 = scan.next();

       System.out.println(replaceLetter(word,txt1,txt2));

   }

   

}

I hope this helps!


Related Questions

I need help I’m behind

Answers

Answer:

The answer to this question is given below in the explanation section.

Explanation:

You use a really long cable to connect the desktop computer in your bedroom to the router on the other side of your house. Which of these may be a problem?

IP/MAC confusionLack of input deviceAttenuationAdaptation

The correct answer to this question is  Attenuation.

Attenuation is the loss of signal strength in networking cables or connections. This may occur when the cable is spread over a long distance.   Attenuation is typically measured in  (dB) decibels or voltage and can occur due to a variety of factors. Attenuation occurs in the cable when there is a reduction in power of the light signal as it is transmitted.

Other options are not correct because IP/MAC confusion will not occur due to long-distance cable. Lack of input device may not create the problem and adaptation also.

WILL MARK BRAINLIEST FOR ANYONES ANSWER!

What things would you consider if you were to make a dream computer with $5,000?

Speed:

Reliability:

Cost comparisons:

Ease of use:

Graphics and streaming media capabilities:

lastly, why you made these choices.​

Answers

Answer:

just know that bit gonna be running when I make mine Imma have 720 fps btw today sponsored is nord VPN

if i need help do i just type it here?

Answers

Answer:

yea you just ask your question and hopefully, someone will answer it like i just did haha

Explanation:

Yeah don’t worry you just ask a question and someone responds :)

What would a digitizing application create?

a raster image

a curved-line vector

a pixel

a straight-line vector

Answers

A digitizing application create is option D: straight-line vector.

What is digitizing process?

The term digitization is the process of transforming analog signals or information in any form into a digital representation that is understandable by computer systems or electronic devices.

It is significant because, by its very nature, information in digital form is not fixed in the same way that text printed on paper is. Additionally, they are easily editable and leave no traces of erasures or emendations. Editing, formatting, and committing print are all pretty simple processes.

Therefore, Bits of information are arranged. In the end, a discrete sequence of points or samples from an object, image, sound, text, or signal one that is typically an analog signal and are represented by a string of integers. Hence, Information transformation techniques is done by option D.

Learn more about digitizing application from

https://brainly.com/question/16455891
#SPJ1

Answer:

A. a raster image

Explanation:

PLEASE HURRY!!
Look at the image below

Answers

Answer:

Second part:

answer = multiply(8, 2)

First part:

def multiply(numA, numB):

 return numA * numB

Third part:

print(answer)

Explanation:

When creating a function, we always start with def function_name(): so the code for the first line is:

def multiply(numA, numB):

 return numA * numB ( * symbol refers to multiplication)

We are now left with two pieces of code: answer = multiply(8, 2) and print(answer). Since we need to always define a variable before using it, answer = multiply(8, 2) will come before print(answer).

Resulting Code:

def multiply(numA, numB):  <- first part

 return numA * numB

answer = multiply(8, 2)  <- second part

print(answer)  <- third part

Hope this helps :)

Rihanna was shopping in a clothing store. She had $100 to spend. She found three items that she liked. The three items were a pair of shoes for $99, a jacket for $98, and a dress for $96. After two hours of shopping, Rihanna decided to borrow some shoes from her sister and to buy the jacket for $98. What was her opportunity cost?

Answers

Answer:

umm i think 293

Explanation:

why do files and programs of secondary storage needed to be transferred to the memory unit ?​

Answers

Secondary storage is needed to keep programs and data long term. Secondary storage is non-volatile , long-term storage. Without secondary storage all programs and data would be lost the moment the computer is switched off. ... solid state storage devices, such as USB memory sticks.

Secondary storage is needed to keep programs and data long term. Without secondary storage all programs and data would be lost the moment the computer is switched off. There are three main types of secondary storage in a computer system: solid state storage devices, such as USB memory sticks.

When should you create an outline?

A. before you create your first slide
B. while you are creating yours slides
C. after you create your last slide
D.after you have presented your slide​

Answers

Answer:

I think A.

Explanation:

Not D.

Not B.

Sorry if I am wrong

What do the letters 'P' and 'T' in PTZ stand for? 'P' stands for and 'T' stands for in PTZ.

Answers

Answer:

Pan, Tilt, Zoom

Explanation:

Essential Components for Creating a PTZ Camera Environment. ... The letters PTZ stand for “Pan, Tilt, Zoom,” which are the basic mechanical functions of these cameras.

Answer:Well want I think the 'P' and 'T' in PTZ stands for the 'P' stands for Pan, and 'T' stands for Tilt?

Explanation:

Python please help.

Why I’m i getting this error

Answers

So, age is a of type string when it should be of type int.

def main():

   age = int(input("How old are you? "))

   if age >= 13:

   #the rest of your code.

Strings cannot be greater than another string only integers and other number based data types. Also, you should change the list variable as I mentioned on the earlier question. Best of luck.

What sorts of changes have you been observing in your society in your society in comparison in last 3 years​

Answers

People care less about their own opinions an more abt others

Hailey was working on a multimedia presentation that included both video and audio files. The file was huge, and she wanted to send it to her coworker in another office. She needed to reduce the size of the file so that it could be transmitted faster. The utility she used to do this was _____.

Answers

Answer:

a compression software such as WinRar

Explanation:

The utility she used to do this would have been a compression software such as WinRar. This software compresses large files or various files into a single ZIP or RAR file. This compressed file is much smaller than the original files that it contains, which is accomplished through a compression algorithm. This can also be encrypted with a password so that only specific individuals with access can open the file. Once unzipped or extracted, the original files are obtained in its original size.

In excel online what is it called when you join connecting cells together to span across more than one column and/or row?
Combine
Connect
Merge
Unite

Answers

Answer:

Combinar

Explanation:

Answer:

Merge

Explanation:

Prepare a profile on major universities in the country Nepal ​

Answers

Answer:

Formal higher learning in Nepal began with the establishment of Tri-Chandra College in 1918, the first college in the country. Until 1985, Tribhuvan University (TU) was the only university in the country. The second university to be founded was Mahendra Sanskrit University. The inception of this university was soon followed by Kathmandu University in 1990, and Purbanchal and Pokhara Universities in 1995 and 1996, respectively. Many schools and colleges are run privately but none of the universities in Nepal are private.

This list includes all notable universities and colleges/campuses in Nepal. Entries are organised by courses offered, and listed in alphabetical order. Some entries that provide multiple courses may be duplicated in each of the relevant categories.

There are fourteen universities in Nepal. They are: Khwopa University (Proposed)

Agriculture and Forestry University in Chitwan

Far-western University in Kanchanpur

Gandaki University in Tanahun

Kathmandu University in Dhulikhel

Lumbini Bouddha University

Madan Bhandari University of Science and Technology

Manmohan Technical University in Biratnagar

Mid Western University in Birendranagar

Nepal Open University[1][2] in Lalitpur

Nepal Sanskrit University

Pokhara University in Pokhara

Purbanchal University in Biratnagar

Rajarshi Janak University in Janakpurdham

Tribhuvan University in Kirtipur

The university that will be profiled in their case is the Agriculture and Forestry University, Chitwan, Nepal.

The Agriculture and Forestry University, Chitwan, Nepal offers undergraduate, graduate, and PhD programs in agricultural sciences.

The university has several faculties such as the faculty of agriculture and animal sciences, fisheries, and aquaculture.

Learn more about universities on:

https://brainly.com/question/25853486

Carlie was asked to review a software prject for her company and determine what materials are needed. Whihc part of project management must she consider?

Answers

Answer:

The answer is "Resources".

Explanation:

All services should definitely be reviewed through Carlie. However many Software Developers, Reviewers, and others are accessible are important to find out. Only then can Carlie find out because needed, the exact timelines. Because whenever establishing precise deadlines, she needs to take a look at the tools, that's why the above given choice is correct.

Answer:

resources

Explanation:

Carlie certainly requires to review the resources. It is important to find out how many software engineers, testers, etc. are available. And only then Carlie can find out the exact deadlines as required here. And hence, she must have look at the resources while determining the specific deadlines. Hence, resources are the correct option.

What is the first priority when building or using vex robots

Answers

Hey I’m doing that too

Answer:

Make sure you add super glue to keep the structure without anything falling off.

Explanation:

Seneca has just applied conditional formatting and realizes that she has made a mistake. Which action should she take to fix the mistake?

A) Clear the rule she created by going to the Conditional Formatting Rules Manager dialog box and deleting the rule.
B) Clear all rules that have been applied to the worksheet or selected range by clicking the Clear Rules button.
C) Use the Undo button or Ctrl+Z.
D) Right-click the area where the conditional formatting rule has been applied, and select Clear Rule from the menu list.

Answers

Answer:

its b

Explanation:

on edg

Answer:

b

Explanation:

Choose the term that makes the sentence true.

Distros are used to distribute different versions of the _______ operating system.

Answers

Answer:

The answer to this question is given below in the explanation section.

Explanation:

The correct answer is Linux.

So, the complete sentence would be:

Distros are used to distribute different versions of the Linux operating system.

The distros are the distribution of the different versions of the Linux operating system. Unlike Windows operating system, distros developed by different software collection that is based upon Linux kernel.

Such as Ubuntu is a distro of the Linux operating system. Linux user usually downloads Linux distro operating system for their systems such as ubuntu etc.

Answer:

Linux.

Explanation:

what important advice to include about spyware, viruses and other types of malware

Answers

Answer:

You should probably include the fact that most of these things will disguise themselves as fake downloads and that will most of the time claim to allow you to download something that costs money for free.

Explanation:

thats all i could come up with

The best antivirus that you need to stay safe from viruses, malware, and spyware is just common sense. Don't click suspicious links to places you don't know. Get a good antivirus. Don't click links with weird names at the end like .co or .it unless you are sure it is a safe website. Don't download weird stuff. Common sense my guys!

Raj needs to apply sorting to a current list in his Word document.

Where should he go to apply the sort?

Home tab Styles group
Home tab Paragraph group
Home tab Editing group
Design tab Sorting group

Answers

Answer:

A, the first one

Explanation:

Raj needs to apply to sort a current list in his Word document. He should go to apply the sort home tab Paragraph group. The correct option is B.

What is a home tab in word?

In Microsoft Word, the Home tab is the default tab. The relevant commands are divided into five groups: Clipboard, Font, Paragraph, Styles, and Editing.

The element is sorted using sorting procedures, either in ascending order or descending order. The user must do the following tasks in order to apply sorting algorithms to any word-type document:

Choose the list that the user wants to use the sorting methods on. To apply the sort, choose the paragraph and text from the Home tab of the Task Pane on the Word document, click Sort, and then decide whether to apply the sort in ascending or descending order.

Therefore, the correct option is B. Home tab Paragraph group.

To learn more about the home tab, visit here:

https://brainly.com/question/2986242

#SPJ2

I need help on this one I’m confused.

Answers

Answer:

true

Explanation:

Answer:

True

Explanation:

Pride Group of Companies is making tremendous profits in different categories of electronic goods. The group of managers have to do analysis of the data to show comparison of sales of past three years, and they also want to showmarket share of the company. A.Do you think charts can help them to represent data easily? If so, how?B.How can they make charts more informative?C.List the type of charts they can make for representation of profits and market share.

Answers

Answer:

Charts are good graphical tools for describing and representing statistics of company data, it categorizes the data and analyzes the impact of one or more values on another. Example of charts used in the data analysis;

Bar chartpie chartscatterplotline plot

Explanation:

Data analysis is the process of collecting and describing data statistically to understand its effects and make future decisions. Graphics in data analysis is vital in representing data for easier understanding, these graphics are called charts

If a person is proactive, they do NOT have to be defensive.
True
False

Answers

The answer is true for this question
Honestly no idea lol

why is hip hop and rap so popular

Answers

Answer:

its popular because hip hop and rap is a way for people to express themselves whether it be their feelings or something that happened in their life and it also evolved from different people

Select the correct answer.
Given the following information, what is the correct way to cite a speech?

The Young Writers Association held a three–day Literary Conference at the First Press Club in Albany, New York. Steven Hans delivered the keynote address.

A.
Hans, Steven. Literary Conference. Young Writers Association. The First Press Club, Albany, NY. Keynote address.
B.
Hans, Steven. Literary Conference. Young Writers Association. The First Press Club, Albany, NY. n.d. Keynote address.
C.
Hans, Steven. Literary Conference. Young Writers Association. The First Press Club, Albany, NY. Keynote address.
D.
Hans, Steven. "Literary Conference". Young Writers Association. The First Press Club, Albany, NY. n.d. Keynote address.

Answers

Answer:

the answer is C i am only 98% sure tho so if i get it wrong forgive me

Explanation:

Answer:

B.

Explanation:

D. is wrong. A and C are most likely wrong because they do not include "n.d.," meaning "no date." There was no date given for the speech, so "n.d." must be included.

What are the characteristics of calendar sharing options in Outlook 2016? Check all that apply.

Answers

Answer:

a,b,c,e

Explanation:

Answer:

Quit your bickering in the replies on the other answer, this is correct.

Explanation:

what type of formula uses data from multiple worksheets

a. abstract formula
b. hyper formula
c. 3D formula
d. unbounded formula

Answers

Answer: I think its 3D formula

Explanation: ...

Example of negative body language include all but

Answers

Answer:

Avoidance of eye contact.

Staring.

Crossed arms.

Overuse of hands.

Looking at watch.

Poor posture.

Frowning.

Sweating.

( but what??)

PLEASE HELPPPP ASAPP

1. which tool would you use if you wanted to arrange a list of words in alphabetical order?
a. conditional formatting
b. format painter
c. arrange
d. sort


2. which of the following is a type of chart in Excel?
a. pie
b. star
c. inverse
d. hierarchy

3. what format would you apply to give an entry the appearance of 12-Mar-2014?
a. date
b. calendar
c. accounting number
d. input

4. what format can be applied to text in Excel?
a. transitions
b. dotted line
c. texture
d. bold

5. when you add a row, where will it appear?
a. underneath the selected row
b. to the right of the selected row
c. above the selected row
d. to the left of the selected row

6. when you add a column, where will it appear?
a. to the left of the selected column
b. underneath the selected column
c. above the selected column
d. to the right of the selected column

Answers

Answer:

1.sort

2.inverse

4.c

5.a

6.b

Explanation:

Hope it helps

a new column is created in table by pressing tab key​

Answers

That is correct
Explanation:
Other Questions
5. Using commutativity and associativity of addition of rational numbers, express eachof the following as a rational number. 1. 2/5 +7/3+-4/5 +-1/32. 3/7+-4/9+-11 /7 +7/93. 2/5+8/3+-11 /15+4/5+-2/34. 4/7+0+-8/9-13/7+17/21So important please tell me fast. Solve: Select the correct equation: Two candles are lit at 6 pm. The 12-in. candle burns 0.5 inches every hour. The 18 inch candle burns two inches every hour. At what time will the two candles be the same height? Let h represent the number of hoursA. h=4B. h=5C. h=1D. h=2 from 24 teachers to 30 teachers a woman make n basket and sell the all at the same price the help would be greatly appreciated for spanish please and thank you ANSWER THIS AND ILL CASH APP YOU !! ( has to be at least 2000 words and make sense)Imagine you are an executive for a Fortune 500 company and you are preparing a presentation for the board of directors about the organizations direction. Choose an organization that is a public company to write this assignment. A pile of pebbles has a weight of 95 kg.Some of the pebbles put into a small bag.The rest of the pebbles is put into a large bag.The pebbles in the large bag weighs 45 kg more than the pebbles in the smallWhat is the weight of the pebbles in the large bag? Look at the diagram. What is the name of muscle 1?Enter your answer24 Can someone pls do this I need this ASAP!!!Describe how Hinduism can be categorized as a religious system.Describe one way that Hinduism may be categorized as a social system. A company issued.. A company issued 10-year, 6.00% bonds with a face value of $100,000. The company received $97,767 for the bonds. Using the straight-line method of amortization, the amount of interest expense for the first interest period is:________.a) $2.233.00 b) $5,776.70 c) $6,000.00 d) $6,223.30 A solution that has a high concentration of hydrogen ions has what type of pH?714132 The graph of the function B is shown below. If B(x) = -1, then what is x?12-1 Where does a nations identity come from? Deposition of Elizabeth Francis at her trial for murder by witchcraft, in Chelmsford Essex,England, 1566A. Describe one way in which the deposition of Elizabeth Francis reflects continuities regarding traditional folkideas of the period 1550-1648.B. Describe one significant change regarding traditional folk ideas of the period 1550-1648 that is not addressed in thepassage. Help ASAP for BRAINLIEST!!!!1/4 (4x - 8) + 3x Show your work and SIMPLIFY If white light is a mixture of all the primary colours of light, what is black? According to Jefferson, what have the colonists attempted in the past? How did the British brethren respond to the colonists efforts? Find x in the logarithm belowlogs x = 5 what responsibility did the publicans have in roman society?