7.6 lab: replacement words write a program that finds word differences between two sentences. the input begins with the first sentence and the following input line is the second sentence. assume that the two sentences have the same number of words. the program displays word pairs that differ between the two sentences. one pair is displayed per line. ex: if the input is: smaller cars get better gas mileage tiny cars get great fuel economy then the output is: smaller tiny better great gas fuel mileage economy hint: store each input line into a list of strings.

Answers

Answer 1

The program that finds word differences between sentences (according to the description) above is given below.

What is a program?

A program is a set of codes and or instructions that are written sequentially and deliberately such that the computer, when it reads and executes them give a specific and premedicated output.

The lines of code that gives the output described above is:

import java.util.Scanner;  public class LabProgram {

     public static int findWordInWordList(String[] wordList, String wordToFind, int numInList) {

       for (int i = 0; i < numInList; i++) {

            if (wordList[i].equals(wordToFind)) {

                return i;

            }         }         return -1;

    }      public static void main(String[] args) {

        Scanner scnr = new Scanner(System.in);

         String[] original = new String[20], modified = new String[20];         int numInList = scnr.nextInt();

        for (int i = 0; i < numInList; i++) {

            original[i] = scnr.next();

           modified[i] = scnr.next();

        }          int numWords = scnr.nextInt();

        String[] words = new String[numWords];

        for (int i = 0; i < numWords; i++) {

            words[i] = scnr.next();

        }          int index;

       for (int i = 0; i < numWords; i++) {

           index = findWordInWordList(original, words[i], numInList);             if (index != -1)

                words[i] = modified[index];

        }          for (int i = 0; i < numWords; i++)             System.out.print(words[i] + " ");

        System.out.println();     } }

Learn more about programing:
https://brainly.com/question/23275071
#SPJ1


Related Questions

Which are the three most used languages for data science?

Answers

Answer: python, JavaScript, scala

Explanation:

Brenda also orders movies and television through the Internet via a(n) ____ provider, which allows users to download video for a fee.

Answers

Brenda also orders movies and television through the Internet via a(n) VOD provider, which allows users to download video for a fee.

What is the meaning of the term VOD?

The term video-on-demand (VOD) is known to be a kind of technology made to send video content, such as movies and television programs, directly to specific customers for quick viewing.

Note that technology is constantly growing and one need to grow along with it. services that are good is often adopted by people.

Hence, Brenda also orders movies and television through the Internet via a(n) VOD provider, which allows users to download video for a fee.

Learn more about movies from

https://brainly.com/question/27936956

#SPJ1

Compared with a large-scale integrated multi-purpose computer, a quantum computer is a ____ computer.

Answers

Answer:

Compared with a large-scale integrated multi-purpose computer, a quantum computer is a high-powered multipurpose application of a quantum computer.

Jenny wants to create a network that can be accessed from any room in her house without physically connecting. Which type of network medium should she use?

Answers

Well I use AT&T in my house it works in all the rooms I suggest using AT&T

The type of network medium Jenny should use is wireless networks.

Given data:

Jenny should use a wireless network medium to create a network that can be accessed from any room in her house without physically connecting.

Wireless networks use radio waves or infrared signals to transmit data between devices, allowing for flexible connectivity without the need for physical cables.

Devices such as smartphones, laptops, tablets, and smart home devices can connect to the wireless network and access the internet or communicate with each other.

To learn more about wireless networks, refer:

https://brainly.com/question/31630650

#SPJ3

Discuss how progressive deepening uses a mixture of dfs and bfs to eliminate the disadvantages of both and at the same time finds the solution is a given tree. support your answer with examples of a few trees.

Answers

IDDFS is known to use both depth-first search’s space-efficiency and also the use of breadth-first search’s fast search due to the fact that  its nodes are closer to the root and IDDFS often calls DFS for a lot of depths starting from a starting value.

What is progressive deepening?

The term progressive deepening is known to be if a person is said to be making effort try to approximate a given answer at every level and they often work to go deep towards the leaf nodes based on the time limit that a person have for their move.

Hence, IDDFS is known to use both depth-first search’s space-efficiency and also the use of breadth-first search’s fast search due to the fact that  its nodes are closer to the root and IDDFS often calls DFS for a lot of depths starting from a starting value.

Learn more about deepening from

https://brainly.com/question/27353529

#SPJ1

Enter a formula in cell C13 to look up the registration fee for the first vehicle. Use the vehicle type in cell C4 as the Lookup_value argument. Use the RegistrationFees named range as the Table_array argument. The registration fees are located in column 2 of the data table. Require an exact match.

Answers

The formula that depicts the registration fee on the computer is Formula at C13 : =VLOOKUP(C4,Data!$B$10:$C$17,2,0)

How to illustrate the information?

A computer program is a sequence or set of instructions in a programming language for a computer to execute.

Computer programs are one component of software, which also includes documentation and other intangible components. A computer program in its human-readable form is called source code

In this case, enter a formula in cell C13 to look up the registration fee for the first vehicle.

Then, one can use the vehicle type in cell C4 as the Lookup_value argument and then use the RegistrationFees named range as the Table_array argument.

Learn more about computer on:

https://brainly.com/question/24540334

#SPJ1

Say true or false
Computer is the main tool of ICT.
b. Cyber crimes play positive role for better use of ICT

Answers

It would be false so (b)
The answers are
a) true
b) false

What is the correct term for files copied to a secondary location for preservation purposes?.

Answers

The correct term for files copied to a secondary location for preservation purposes is backup.

What is a Backup?

This refers to the movement of files from one location to another for storage purposes.

Hence, we can see that this is done in order to preserve the files so that should the first memory location get compromised, it can be easily retrieved and this helps to prevent data loss.

Read more about backups here:

https://brainly.com/question/27960592

#SPJ1

What is an effective fully automated way to prevent malware from entering your system as an email attachment

Answers

An effective fully automated way to prevent malware from entering your system as an email attachment is to ensure that all security patches and updates are installed.

What is malware?

Malware is any software intentionally designed to cause disruption to a computer, server, client, or computer network, leak private information, gain unauthorized access to information or systems, deprive users access to information or which unknowingly interferes with the user's computer security and privacy.

Effective fully automated way to prevent malware

The following ways can be used to prevent malware;

Make sure all security patches and updates are installedInstall updates and patches as soon as possible to protect against malware and other digital threats. Turn on automatic updates whenever possible. use unique and strong passwords to secure your account.

Thus,  an effective fully automated way to prevent malware from entering your system as an email attachment is to ensure that all security patches and updates are installed.

Learn more about malware here: https://brainly.com/question/399317

#SPJ1

What port on a name server is used for user datagram protocol (udp) name request packets?

Answers

The port name that is used on the server is port 53 over UDP for name resolution communications.

What is datagram protocol?

A datagram protocol is a member of the internet protocol. With this system, we can send messages and texts to the other protocol systems in applications, and other hosts on internet data protocol.

Port 53 is used for sending requests to other ports, and it is a single request service used by UDP. It requires a single UDP request from the clients.

Thus, port 53 on a name server is used for user datagram protocol.

To learn more about datagram protocol, refer to the below link:

https://brainly.com/question/27835392

#SPJ1

________ software modules deal with setting employee objectives, performance, and compensation. scm prm drm erm sfa

Answers

ERM software modules deal with setting employee objectives, performance, and compensation. option D is the answer.

What are software modules?

Software module are component of a program and not the main programme.

They form essential part of the main programme with or more routines. One or more modules developed separately make up a program.

ERM software can be used for various businesses and in organization settings. It helps to identify compensation and monitor performance of the organization.

Enterprise risk software (ERM) is essential in managing various risk attached to a Job.

Therefore, ERM software modules deal with setting employee objectives, performance, and compensation

Learn more on software below

https://brainly.com/question/14635097

#SPJ1

The five components of accounting systems are source documents, input devices, information processors, information storage, and output devices. Group startsTrue or False

Answers

Answer:

True

Explanation:

Source documents are business documents that track business transactions.

Input devices, like bar code scanners, keyboards, and modems, are tools used to enter transaction information into the accounting system.

Information processors take the raw data from the input devices and post it to ledgers, journals, and reports.

Information storage is the component of the system that stores the reports and ledgers created by the information processors.

Output devices like monitors, printers, and projectors are any devices that take information from the system storage and display it in a useful way.

These components are all what help an accounting system gather financial data, translate it into useful information, and communicate it with decision makers.

Answer:

true cause they are used to process information

Paul has opened a bespoke tailoring shop. He wants to work online to keep a database of all his customers, send e-mails when garments are ready, create designs, and maintain financial records using software. Which productivity suite should he consider?.

Answers

In the case above, the productivity suite that Paul should consider is OpenOffice, G suite.

What is G Suite used for?

G Suite Basic edition is known to be a kind of a suite that is made up of collaborative productivity apps that tends to give one's business professional email, shared calendars, and others.

Hence, In the case above, the productivity suite that Paul should consider is OpenOffice, G suite.

See options below

Which productivity suites should he consider?

a. Prezi, G suite

b. G suite, Zoho

c. OpenOffice, G suite

d. Zoho, Apple iWork

Learn more about financial records from

https://brainly.com/question/4954869

#SPJ1

NEED HELP ASAP
If you had two proxy servers located in the same room, what use could you make of them?

nothing
create a hub
sell one of the servers
set up a network neutral zone

Answers

If you had two proxy servers located in the same room, what use could you make of them? B. Create a hub

What is a Proxy Server?

A proxy server is a server program used in computer networking that stands between a client requesting a resource and the server supplying that resource.

Every computer or Ethernet-based device linked to a network hub receives data that is broadcast to all of those devices and that's what two proxy servers would be used to do.

Read more proxy servers here:

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

Classes that depend on field names from parent classes are said to be ____ because they are prone to errors.Group of answer choicesrobustinnovativefragileconstructive

Answers

Classes that depend on field names from parent classes are generally said to be fragile because they are very prone to coding errors.

What is a class?

A class can be defined as a user-defined blueprint (prototype) or template that is typically used by software programmers to create objects and define the data types, categories, and methods that should be associated with these objects.

In object-oriented programming (OOP) language, a class that is written or created to implement an interface would most likely implement all of that interface's method declarations without any coding error.

In Computer programming, we can infer and logically conclude that classes that are highly dependent on field names from parent classes are generally said to be fragile because they are very prone to coding errors.

Read more on class here: brainly.com/question/20264183

#SPJ1

The ____________ layer of the osi model is responsible for data format translation

Answers

Answer:

Presentation

Explanation:

The sixth layer of the OSI model, responsible for translation, encryption, authentication, and data compression.

What tool allows you to search external competitive intelligence research?

Answers

Answer:

SocialPeta

Explanation:

(Convert decimals to fractions) Write a program that prompts the user to enter a decimal number and displays the number in a fraction. Hint: read the decimal number as a string, extract the integer part and fractional part from the string, and use the BigInteger implementation of the Rational class in Programming

Answers

The given program that prompts the user to enter a decimal number and displays the number in a fraction is:

import java.math.BigInteger;

import java.util.Scanner;

public class Exercise_13_19 {

/** Main method */

public static void main(String[] args) {

 Scanner input = new Scanner(System.in);

 // Prompt the user to enter a decimal number

 System.out.print("Enter a decimal number: ");

 String[] decimal = input.nextLine().split("[.]");

 // Create a Rational object of the integer part of the decimal number

 Rational r1 = new Rational(new BigInteger(decimal[0]), BigInteger.ONE);

 // Create a Rational object of the fractional part of the decimal number

 Rational r2 = new Rational(new BigInteger(decimal[1]), new BigInteger(

  String.valueOf((int)Math.pow(10, decimal[1].length()))));

 // Display fraction number

 System.out.println("The fraction number is " +

  (decimal[0].charAt(0) == '-' ? (r1).subtract(r2) : (r1).add(r2)));

}

}

Read more about java programming here:

https://brainly.com/question/26952414

#SPJ1

Which type of loop is specifically designed to initialize, test, and increment or decrement a counter variable

Answers

A type of loop which is specifically designed and written to initialize, test, and increment or decrement a counter variable is referred to as a for loop.

What is a for statement?

A for statement can be defined as a type of statement (loop) that is designed and written by a computer programmer to repeat an action or event in a software program for a specific number of time.

In Computer programming, a for statement is a type of loop which contains three expressions and these include the following:

InitializationTestUpdate (increment or decrement).

In conclusion, we can infer and logically deduce that a for loop is a type of loop which is specifically designed and written to initialize, test, and update (increment or decrement) a counter variable

Read more on statements here: brainly.com/question/18736215

#SPJ1

Define a function ConvertVolume() that takes one integer parameter as total Quartz, and two integer parameters passed by reference as gallons and quarts. The function converts total Quarts to gallons and quarts. The function does not return any value. Ex: If the input is 23, then the output is: 5 gallons and 3 quarts Note: totalQuarts / 4 computes the number of gallons, and totalQuarts % 4 computes the remaining quarts.

Answers

The program that illustrates the function ConvertVolume() that takes one integer parameter is illustrated below.

How to illustrate the program?

The program based on the information will be:

#include<iostream>

using namespace std;

void ConvertVolume(int totalTablespoons, int &cups, int &tablespoons) {

   // compute the cups and tablespoons

   // as they are passed by reference,

   // the change will also reflect in the main function

   cups = totalTablespoons / 16;

   tablespoons = totalTablespoons % 16;

}

int main() {

   int usrCups;

   int usrTablespoons;

   int totalTablespoons;

   

   // user input

   cin>>totalTablespoons;

   

   // call the function

   ConvertVolume(totalTablespoons, usrCups, usrTablespoons);

   

   // print the output

   cout<<usrCups<<" cups and "<<usrTablespoons<<" tablespoons"<<endl;

   

   return 0;

}

Learn more about program on:

https://brainly.com/question/26642771

#SPJ1

What component of a change management program includes final testing that the software functions properly

Answers

A component of a change management program which includes final testing that the software functions properly is: C) Release management.

What is SDLC?

SDLC is an acronym for software development life cycle and it can be defined as a strategic methodology that defines the key steps, phases, or stages for the design, development and implementation of high quality software programs (applications).

In Computer science, there are seven (7) phases involved in the development of a software program and these include the following;

PlanningAnalysisDesignDevelopment (coding)TestingDeploymentMaintenance

At the final testing stage, a component of a change management program which ensure that the software functions properly is known as release management.

Read more on software here: brainly.com/question/26324021

#SPJ1

Complete Question:

What component of a change management program includes final testing that the software functions properly?

A) Request management

B) Change management

C) Release management

D) Iteration management

On a Local Area Network, or LAN, what identification do nodes use to communicate with each other internally

Answers

On a Local Area Network, or LAN. MAC addresses are the identification that nodes use to communicate with each other internally. This is further explained below.

What is the MAC address?

Generally, A media access control address, often known as a MAC address, is a one-of-a-kind identification that is given to a network interface controller (NIC) in order for it to be used as a network address in communications that take place inside a network segment. This use is typical in the vast majority of networking technologies based on IEEE 802, such as Ethernet, Wi-Fi, and Bluetooth.

In conclusion, On a LAN, or local area network. Nodes interact with each other inside using MAC addresses.

Read more about the MAC address

https://brainly.com/question/27960072

#SPJ1

A data analyst uses the SMART methodology to create a question that encourages change. This type of question can be described how

Answers

A data analyst uses the SMART methodology to create a question that encourages change, which can be described as an action-oriented question.

What is a data analyst?

A data analyst is a professional that studies information in order to obtain any type of outcome.

In computers, data analysts can use the SMART methodology which includes diverse criteria to increase the chances of success.

In conclusion, a data analyst uses the SMART methodology to create a question that encourages change, which can be described as an action-oriented question.

Learn more about data analysts here:

https://brainly.com/question/27960551

#SPJ1

________ is the process of converting an algorithm into a language the computer can understand.

Answers

Answer:

coding

Explanation:

A process of assigning a code to something for classification. The process or activity writing computer program

Ed wants to make sure that his system is designed in a manner that allows tracing actions to an individual. Which phase of access control is Ed concerned about

Answers

The phase of access control that one can say that Ed is more concerned about is called Accountability.

What is accountability?

Accountability is known to be one that removes the time and effort you that is used on distracting activities and a lot of unproductive behavior and it makes one to be more focused.

Hence, The phase of access control that one can say that Ed is more concerned about is called Accountability.

Learn more about Accountability from

https://brainly.com/question/27958508

#SPJ1

Use the writeln() method of the document object to display the current platform in a

tag in the webpage. Hint: The platform property of the window.navigator object contains the current platform.

Answers

Using the knowledge in computational language in JAVA it is possible to write a code that the document object to display the current platform in a tag in the webpage

Writting the code in JAVA:

<TABLE>

     <ROWS>

     <TR>

     <TD>Shady Grove</TD>

     <TD>Aeolian</TD>

     </TR>

     <TR>

     <TD>Over the River, Charlie</TD>

     <TD>Dorian</TD>

     </TR>

     </ROWS>

     </TABLE>

   

See more about JAVA at brainly.com/question/12975450

#SPJ1

An application is hosted on an EC2 instance in a VPC. The instance is in a subnet in the VPC, and the instance has a public IP address. There is also an internet gateway and a security group with the proper ingress configured. But your testers are unable to access the instance from the Internet. What could be the problem

Answers

In this scenario, the most likely problem is to: D. add a route to the route table, from the subnet containing the instance, to the Internet Gateway.

What is RIP?

RIP is an acronym for Routing Information Protocol and it can be defined as an intradomain routing protocol which is typically designed and developed based on distance vector routing.

The types of RIP.

In Computer networking, there are two main types of Routing Information Protocol (RIP) and these include:

RIP version 1.RIP version 2.

RIP version 2 such as an EC2 instance in a VPC are generally designed and developed to include subnet masks. This ultimately implies that, the most likely solution to the problem is to add a route to the subnet’s routing table, which is from the subnet containing the instance and then to the Internet Gateway.

Read more on routing protocol here: https://brainly.com/question/24812743

#SPJ1

Complete Question:

An application is hosted on an EC2 instance in a VPC. The instance is in a subnet in the VPC, and the instance has a public IP address. There is also an internet gateway and a security group with the proper ingress configured. But your testers are unable to access the instance from the Internet. What could be the problem?

A. Make sure the instance has a private IP address.

B. Add a route to the route table, from the subnet containing the instance, to the Internet Gateway.

C. A NAT gateway needs to be configured.

D. A Virtual private gateway needs to be configured.

Write a while loop that adds 5 to userNum while userNum is less than 20, displaying the result after each addition. Ex: For userNum

Answers

#The loop that adds 5 to userNum while userNum is less than 20, displaying the result after each addition is given below.

What is a loop?

A loop is a set of instructions in computer programming that is repeatedly repeated until a given condition is met.

The sample code related to the above function is given as?

// declaring variable userNum

var userNum = 5;

// variable ans to store all answers and print them in single line

// (as expected in sample output)

var ans = "";

// while loop, while userNum is <= 20

// (to get output 25 on screen, we need to run loop till less-than-equal) while(userNum <= 20) {

  userNum += 5;

  ans += userNum + " ";

}

// displaying final output on console

console.log(ans);  

Learn more about loops at;
https://brainly.com/question/26568485
#SPJ1

Data Blank______ is the collection of data from various sources for the purpose of data processing. Multiple choice question. summary management aggregation

Answers

Answer: data aggregation

Explanation:

data aggregation

What are the three modes of data communication and briefly explain each of them?

Answers

The three modes of data communication

The Full-duplex modeThe simplex mode The  half-duplex mode

What are three data transmission modes?

The Full-duplex mode is known to have a good and better performance when compared to simplex and half-duplex mode as it is known to often doubles the utilization in terms of the capacity of the communication channel.

The simplex mode in terms of its signal is known to be sent in one direction. In half duplex mode, the signal is said to be often sent in both directions, but it is also seen as one at a time.

Learn more about communication from

https://brainly.com/question/26152499

#SPJ1

Other Questions
In which circumstance is food and/or beverage allowed in the laboratory? a. never b. if containers are kept out of sight c. if containers are covered d. if containers are sealed true/false. At the turn of the 1800s camp meetings in the United States were not segregated by cultural background. 50 Points! Multiple choice geometry question. Photo attached. Thank you! Which situational change would not have made it more likely that someone would've acted to help Kitty Genovese during her attack?if there had been 76 witnesses instead of 38 witnesses Find the arc length of curve y=3x321, over [0,1]. What is the impedance of a 5 micro farad capacitor at a frequency of 500Hz? What is the impedance of a 60mH inductor at this frequency? find the derivative of the function. g(x) = 7x u2 2 u2 2 du 3x hint: 7x f(u) du 3x = 0 f(u) du 3x 7x f(u) du 0 a 60.0-kg skater begins a spin with an angular speed of 6.0 rad/s. by changing the position of her arms, the skater decreases her moment of inertia by 50 %. what is the skater's final angular speed? Chicken pox is viewed as a lifelong disease that produces different manifestations at different ages. This is an example of which of the following uses of systems analysis? A) Incorporate interactions between factors to better understand the etiology of disease. B) Take into account the interactions between diseases. C) Utilize systems analysis to help understand the impact of a discase over the life span. D) Help identify bottlenecks and leverage points that can be used to improve population health. Ahead: How Can Systems Thinking Help Take Into Account the Interactions Between Diseases? when using the direct approach, what must you open your message with? establishing common routines and operating procedures that apply uniformly to everyone is called ________. Convert 580 psi to megapascals. 1 MPa = 145 psi. Write an algebraic equation to show your solution. Which term means the spread of fire from one floor to another via exterior windows?A) LadderingB) Vertical fire extensionC) Stack effectD) Crowning A marketable permit provides its owner with the right to pollute a specified amount. The number of permits in existence is determined by _____. _____ allowed to purchase permits. If a person does not pay their taxes, he or she can be charged with a crime.Why is it important for all people to pay their taxes?A because the national debt is too highB because there is not much money to go aroundC because businesses need tax dollars to make goods and servicesD because governments need the money to provide citizens with services somatic motor neurons must be ________ to relax the external urethral sphincter to allow urination. PLS HELP!!!!!!!! 50 POINTS!!!!!!!! ACCURATE ANSWER PLS!!! ILL GIVE BRAINLIEST AND 5 STARS. What is the difference between anaerobic and aerobic systems and give some examples of sports which use either the aerobic or anaerobic system. what is the artifact occurs when the tracing looks normal at the beginning, but then goes all over when the electrical connection is interrupted? Someone says to you, "If a company is already using sales and operations planning to coordinate marketing and operations, then it doesnt need master scheduling as well." Is this true? How are S&OP and master scheduling similar? How are they different? What information does master scheduling provide that S&OP does not? How difficult would it be to develop successful master schedules without doing S&OP first? a patent that was acquired for $1,200,000 at the beginning of the current year expires in 20 years and is expected to have a useful life of 5 years.