If you do not already have Visual Studio Express 2012 or later installed, downlo
ID: 3794786 • Letter: I
Question
If you do not already have Visual Studio Express 2012 or later installed, download and install it (Microsoft Corporation, 2012b).
Solve the following programming problems in C#. Submit your source files including several test cases to show your solutions work as expected.
Write a program that reads text from standard input and outputs a report with each word and the number of instances of that word from the text. The program should continue reading input until EOF. Punctuation and whitespace are ignored. Casing is insignificant.
Example:
C:Homework> java MyProgram < input.txt
There were 5 unique words and 6 total words in the document.
hello: 1 occurrence
world: 1 occurrence
foo: 2 occurrences
bar: 1 occurrence
quux: 1 occurrence
Write a program that reads a list of integers (separated by whitespace and terminated by EOF) and reports the second largest integer.
Examples:
Enter a list of integers: 3 7 444 9 10 12
The second-largest integer was 12.
Write a program that solves the string reversal problem, which you previously implemented in Java.
Write a program that solves the rectangle overlapping problem, which you previously implemented in Java.
Explanation / Answer
answer of section C is
import java.util.*;
class ReverseString
{
public static void main(String args[])
{
// variable's to be used
String enteredString, reverseString = "";
Scanner in = new Scanner(System.in);
//take input string from the user
System.out.println("Enter a string");
reverseString = in.nextLine();
//length of string
int length = reverseString.length();
//loop to reverse
for ( int i = length - 1 ; i >= 0 ; i-- )
reverseString = reverseString + reverseString.charAt(i);
System.out.println("Reverse of string is: "+reverseString);
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.