Java: An Introduction to Problem Solving and Programming (8th Edition)
8th Edition
ISBN: 9780134462035
Author: Walter Savitch
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Expert Solution & Answer
Chapter 11, Problem 11E
Explanation of Solution
Complete program:
//Import required packages
import java.util.*;
//Definition of class MesText
public class MesText
{
//Definition of class main
public static void main(String[] args)
{
//Declare the variable
int value;
//Create an object for scanner class
Scanner sc = new Scanner(System.in);
//Get the time from the user
System.out.println("Enter the time:");
//Get the values
value = sc.nextInt();
//Call the method "Text"
int result = Text(value);
//Print the number of messages
System.out...
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Consider the code C={00010, 01100,01011,11010,01010}. What is the minimum distance of C? For what k is the code C k-error detecting? Write the set of error patterns that C can detect?
Let's say that the components of U are arranged in ascending order, with U = l, 2, 3, 4, 5, 6, 7, 8, 9, and 1 O, which means that aj = i. What bit strings encompass the subsets of all odd numbers in U, all even integers in U, and all integers in U that do not exceed 5?
Let A = {c, n, b}, B = {x, y} and C = {0, 1}.
Find
A)A X B X C
B)C X B X A
C)B X C X C
Chapter 11 Solutions
Java: An Introduction to Problem Solving and Programming (8th Edition)
Ch. 11.1 - What output will be produced by the following...Ch. 11.1 - What is the output produced by the following code?Ch. 11.1 - Write a recursive definition for the following...Ch. 11.1 - What is the output of the following code? public...Ch. 11.1 - Prob. 5STQCh. 11.1 - Complete the definition of the following method....Ch. 11.2 - Revise the method getCount in Listing 11.5 so that...Ch. 11.2 - Prob. 8STQCh. 11.2 - Prob. 9STQCh. 11.2 - Suppose you want me class ArraySearcher to work...
Ch. 11.2 - What Java statement will sort the following array,...Ch. 11.2 - How would you change the class MergeSort so that...Ch. 11.2 - How would you change the class MergeSort so that...Ch. 11.2 - If a value in an array of base type int occurs...Ch. 11.3 - Convert the following event handler to use the...Ch. 11 - What output will be produced by the following...Ch. 11 - What output will be produced by the following...Ch. 11 - Write a recursive method that will compute the...Ch. 11 - Write a recursive method that will compute the sum...Ch. 11 - Complete a recursive definition of the following...Ch. 11 - Write a recursive method that will compute the sum...Ch. 11 - Write a recursive method that will find and return...Ch. 11 - Prob. 8ECh. 11 - Write a recursive method that will compute...Ch. 11 - Suppose we want to compute the amount of money in...Ch. 11 - Prob. 11ECh. 11 - Write a recursive method that will count the...Ch. 11 - Write a recursive method that will remove all the...Ch. 11 - Write a recursive method that will duplicate each...Ch. 11 - Write a recursive method that will reverse the...Ch. 11 - Write a static recursive method that returns the...Ch. 11 - Write a static recursive method that returns the...Ch. 11 - One of the most common examples of recursion is an...Ch. 11 - A common example of a recursive formula is one to...Ch. 11 - A palindrome is a string that reads the same...Ch. 11 - A geometric progression is defined as the product...Ch. 11 - The Fibonacci sequence occurs frequently in nature...Ch. 11 - Prob. 4PPCh. 11 - Once upon a time in a kingdom far away, the king...Ch. 11 - There are n people in a room, where n is an...Ch. 11 - Prob. 7PPCh. 11 - Prob. 10PPCh. 11 - Prob. 12PP
Knowledge Booster
Similar questions
- Suppose you have a finite state machine that accepts bit strings divisible by 11. The FSM has 11 states R0, R1, ... , R10, each corresponding to the remainder when dividing by 11. Input is fed to the FSM one bit at a time from left to right, the same way we did in our in-class examples. If the machine is currently in state R7, an input of 1 should transition it to which state? Type the subscript only of the new state. Your answer should be an integer between 0 and 10, inclusive.arrow_forwardSuppose that you pick a bit string from the set of all bit strings of length ten. What is the probability that the bit string has more 0s than 1s?arrow_forwardSuppose you’re consulting for a bank that’s concerned about fraud detection, and they come to youwith the following problem. They have a collection of n bank cards that they’ve confiscated, suspectingthem of being used in fraud. Each bank card is a small plastic object, containing a magnetic stripe withsome encrypted data, and it corresponds to a unique account in the bank. Each account can have manybank cards corresponding to it, and we’ll say that two bank cards are equivalent if they correspond to thesame account.It’s very difficult to read the account number off a bank card directly, but the bank has a high-tech “equivalence tester” that takes two bank cards and, after performing some computations, determines whether theyare equivalent.Their question is the following: among the collection of n cards, is there a set of more than n/2 of themthat are all equivalent to one another? Assume that the only feasible operations you can do with the cardsare to pick two of them and plug them…arrow_forward
- We consider certain strings of length 6 over the alphabet S = {A,B,C}. We require that the string contains exactly two As, and exactly two B's, and exactly two C's. How many such strings are there? That is, how many strings of length 6 over the alphabet {A,B,C} contains exactly two A's, two B's and two C's?arrow_forwardIf a is a symbol and n > 0, then an denotes a···a, or in words, the string of length n consisting of only a’s. Now consider the coding with two code words 0n and 1n, for some natural number n > 0. Show that this coding is perfect if and only if n is odd.arrow_forwardGive an NFA over a single letter alphabet that rejects some string, but the length of the shortest rejected string is strictly more than the number of states. (Hint: Build an NFA with seven states arranged in loops of length two and five. Assign start and final states so that the shortest rejected string is of length 9 = 2 * 5 − 1.)arrow_forward
- Transform the following sentences to CNF. 1. ꓯ x (P(x) ꓦ Q(x)) → R(x) 2. ꓯ x ꓯ y ꓯ z (A(x,y) ꓥ A(y,z)) → A(x,z) 3. ꓯ x ꓯ y ꓱ z P(x,z) ꓥ Q(y,z) 4. ꓯ x ⌐ [(P(x) ꓥ Q(x)) ꓦ (R(x) ꓥ S(x))]arrow_forwardLet L={ w in(0 + 1)* 1 | w has even number of 1s}, i.e. L is the set of all bit strings with even number of 1s. Which one of the regular expression below represents L? (A) (0* 10* 1)* (B) 0* (10* 10* )* (C) 0* (10* 1* )* 0* (D) 0* 1(10* 1)* 10*arrow_forwardThis paper deals with Extended Huffman Codes. For instance, for a source emitting two symbols A and B, the second order extension involves coding messages AA, AB, BA and BB (2^2 in number). The third order extension involves messages such as AAA, AAB, etc. (2^3 in number). The probabilities of such strings are computed by multiplying the individual probabilities. Calculate third, fourth and fifth order extensions of a source message. 1. Choose an alphabet a set of at least six (6) symbols with assigned probabilities. It can be assigned as [ A=0.3; B= 0.7; C=0.1;D=0.2;E=0.5;F=0.15]. Compute the third, fourth and fifth order extension probabilities. Using the built-in algorithm, derive the Huffman Code for each extension. Compute the following quantities: (i) Average length of the codeword; (ii) The code efficiency; (iii) The Compression Ratio. Note: I am assuming but needs to be verified that if we need are using 6 symbols A to F. 6^3=216, the 6 to the third power comes…arrow_forward
- Let l be a line in the x-yplane. If l is a vertical line, its equation is x = a for some real number a. Suppose l is not a vertical line and its slope is m. Then the equation of l is y = mx + b, where b is the y-intercept. If l passes through the point (x₀, y₀), the equation of l can be written as y - y₀ = m(x - x₀). If (x₁, y₁) and (x₂, y₂) are two points in the x-y plane and x₁ ≠ x₂, the slope of line passing through these points is m = (y₂ - y₁)/(x₂ - x₁). Instructions Write a program that prompts the user for two points in the x-y plane. Input should be entered in the following order: Input x₁ Input y₁ Input x₂arrow_forwardThe Lingala Language of Republic of Congo has 35 letters. Consider an Affine cipher, which encrypts each letter according to the rule: C=(p×k1+k2) mod 35. Here C, p, k1, and k2 are each members in the range 0 to 34, where C represents the ciphertext letter, p the plaintext letter, and k1 and k2 are constant keys. How many possible keys does this affine system have? Explain in details.arrow_forwardImplement a class RLE that uses fixed-length encoding, to compress ASCII bytestreams using relatively few different characters, includingthe code as part of the encoded bitstream. Add code to compress() to make a stringalpha with all the distinct characters in the message and use it to make an Alphabet foruse in compress(), prepend alpha (8-bit encoding plus its length) to the compressedbitstream, then add code to expand() to read the alphabet before expansion.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Operations Research : Applications and AlgorithmsComputer ScienceISBN:9780534380588Author:Wayne L. WinstonPublisher:Brooks Cole
Operations Research : Applications and Algorithms
Computer Science
ISBN:9780534380588
Author:Wayne L. Winston
Publisher:Brooks Cole