Question

Write a map reduce algorithm to count punctuations (like comma, period, colon, semicolon, etc). Show steps...

Write a map reduce algorithm to count punctuations (like comma, period, colon, semicolon, etc). Show steps of your algorithm on sample input.

Write a map reduce program in java to implement the above algorithm. Show the screenshots of the steps of compilation and output.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

copyable code:

// include header files

import java.util.*;

// define a class

public class MapReduce

{

    // main function

public static void main(String[] args)

   {

       // Perform following process

       Scanner scan= new Scanner(System.in);

       System.out.println("Enter The Statement: ");

       String data= scan.nextLine();

       char array[]= data.toCharArray();

       int num =0;

       for(int x=0;x<array.length;x++)

       {

         if (array[x]==','||array[x]=='.'||array[x]==';'||array[x]=='"'||array[x]==':'){

              num++;

           }

       }

       System.out.println("Number Of Charaers Are: "+num);

   }

}

Add a comment
Know the answer?
Add Answer to:
Write a map reduce algorithm to count punctuations (like comma, period, colon, semicolon, etc). Show steps...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write an insertion sort algorithm that uses Binary search to find the position where the next...

    Write an insertion sort algorithm that uses Binary search to find the position where the next insertion should take place. Show your work using a programing language such as Java and add your screenshots of the output. show the steps please

  • Create an algorithm to count the number of 1’s in a 32-bit number. Implement the program in a high level language like...

    Create an algorithm to count the number of 1’s in a 32-bit number. Implement the program in a high level language like C or Java. It does not need to run for me, but the code should be included in a text document called FirstnameLastnameHLA3.txt along with your assignment submission. Implement the program in MIPSzy Assembly language. Use the high level code as comments to the right of the Assembly code as the textbook does. If you write that MIPSzy...

  • Count Occurrences in Seven Integers Using Java Single Dimension Arrays In this assignment, you will design...

    Count Occurrences in Seven Integers Using Java Single Dimension Arrays In this assignment, you will design and code a Java console application that reads in seven integer values and prints out the number of occurrences of each value. The application uses the Java single dimension array construct to implement its functionality. Your program output should look like the sample output provided in the "Count Occurrences in Seven Integers Using Java Single Dimension Arrays Instructions" course file resource. Full instructions for...

  • Practice Problem [no points]: You should read and understand Fibonacci algorithm, write a code in a...

    Practice Problem [no points]: You should read and understand Fibonacci algorithm, write a code in a high level language of your choice and in Assembly to find a Fibonacci number and check your result. At the end of this assignment a possible solution to this problem is given both in Python and MIPS assembler. Note that it would have been possible to write the Python differently to achieve the same function. . [20 points] Write and debug a MIPS program...

  • Map, Filter, and Reduce are three functions commonly used in functional programming. For this assignment you...

    Map, Filter, and Reduce are three functions commonly used in functional programming. For this assignment you will be implementing all three, along with three minor functions that can be passed to them. Map The map function takes as arguments a function pointer and a integer vector pointer. It applies the function to every element in the vector, storing the results in-order in a new vector. It then returns a pointer to a new vector. You should pass your square function...

  • Write a Java program that calculates how much a person would earn after a period of...

    Write a Java program that calculates how much a person would earn after a period of time, according to the following rules: 1. The starting salary for the first day is $1. 2. The salary will double each day. Ask the user to input the number of days worked. The output should display how much the salary was for each day worked, and show the total pay at the end of the work period. Get output similar to the sample...

  • Write a C++ function, parsePhrases(...), that takes a string and replaces every comma ‘,’ and period...

    Write a C++ function, parsePhrases(...), that takes a string and replaces every comma ‘,’ and period ‘.’ with the newline character ‘\n’. Important: the function should edit the string (i.e. there should be no cout << calls within the function). Example Program: #include <iostream> using namespace std; // TODO: implement function parsePhrases (...) - no cout calls; int main() { string text = "In theory there is no difference between theory and "; text += "practice. In practice there is....

  • 1. Write a Java program to implement Counting Sort and write a driver to test it....

    1. Write a Java program to implement Counting Sort and write a driver to test it. Note: use random number generator to generate your input with n = 10, 50, and 100. Verify that the running time is O(n). 2. Write a Java program to implement Bucket Sort and write a driver to test it. Note: use random number generator to generate your input with n = 10, 50, and 100. Verify that the running time is O(n). 3. In...

  • What to submit: your answers to exercises 2. Write a Java program to perform the following...

    What to submit: your answers to exercises 2. Write a Java program to perform the following tasks: The program should ask the user for the name of an input file and the name of an output file. It should then open the input file as a text file (if the input file does not exist it should throw an exception) and read the contents line by line. It should also open the output file as a text file and write...

  • Write a program that calculates the amount a person would earn over a 30-day period of...

    Write a program that calculates the amount a person would earn over a 30-day period of time if his/her salary is one penny the first day, two pennies the second day, and continues to double each day. The program should display a table showing the salary for each day, and then show the total pay at the end of the period. The output should be displayed in a dollar amount, not the number of pennies. A sample output might look...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT