In a text messaging system, data is sent from one device to another. Devices are recognized by a unique device ID. The format of the message is sent as a string with information about the number of characters in the device ID, the device ID itself, the number of characters in the text message and the text message that is being sent with each part being separated by a space. The system uses this information to send the message to the correct device and the receiving device displays only the text message. The number of words in the text message is also useful. A word is defined by strings separated by spaces.
Here is a sample VALID message:
04 1234 05 hello
The first two digits in the string represent the length of the device ID to follow.
The device ID is the number of characters following the length. Note that the device ID may not be limited to number values.
Following the device ID is the length of the text message and then the text message itself. The text message may be any combination of characters (such as letters, numbers or symbols) and may include spaces.
This message contains one word.
Here is a sample INVALID message:
06 a2b10 09 I’m ready
The first two values 06 indicate the device ID length. The device ID is a2b10 which has a length of 5. This does not match the specified length 06. Thus, this is NOT a valid message.
This message contains two words.
The Message class represents messages in this system. A Message must have a device ID, the length of the ID, the length of the message and the text message being sent in order to be a valid message sent through the system. The Message class must determine if a message is valid in order to send a message. A valid message is one where the device ID length matches the given length in the message string and the text message length matches the length of the supplied text message. The text message consists of one or more words where the length of the text message string is at least one character.
Consider the code below:
Message msg1 = new Message("08 abc123xy 16 Computer Science"); //creates a new message object
boolean msg1Valid = msg1.isValid(); // returns true for a valid message
String text = "11 radio11a287 14";
Message msg2 = new Message(text);
boolean msg2Valid = msg2.isValid(); // returns false for an invalid message
Message msg3 = new Message("04 92a1 16 Computer Science");
Message msg4 = new Message("03 x8r 21 Today is a great day!");
int numWords = msg4.wordCount(); //returns 5, the number of words in the
//text message
Complete the Message class by writing the isValid() and wordcount() methods.
public class Message{
private int idLength;
private String deviceID;
private int msgLength;
private String textMsg;
public Message(String msg){
//implementation not shown
}
public boolean isValid(){
//to be written
}
public int wordCount(){
//to be written
}

Answers

Answer 1

Answer:

public int wordCount() {

       String[] arr = textMsg.split(" ", 0);

       return arr.length();

   }

public boolean isValid() {

       if (idLength == deviceID.length()) {

           if (msgLength == textMsg.length()) {

               return true;

           } else {

               return false;

           }

       return false;

   }

Explanation:

The Java source code defines two methods in a class named Message namely; isValid() and wordCount(). The isValid() method evaluates the validity of a message sent to return a boolean value while the wordCount() counts and returns the number of words in the message.


Related Questions

Add the beginning comments at the top of the program.
In the first part of your program, create a for loop that runs three times:
Inside the for loop, prompt the user for an integer
Prompt the user for another integer
Call the function compare (you are going to create this function next)
Pass the variables that you used for the integer inputs from above
Create a function called compare (remember the function definition should go at the top of the program) and use two variables in the parameters of the function:
Inside of the function, create an if / elif / else structure that compares the two values passed into the function
If one value is less than the other, output that to the user (Ex: 2 is less than 4)
Elif the other value is less than the other output something similar (Ex: 4 is less than 9)
Else, output that they are equal to each other
That is it for the first part of the program.
Next, create an empty list called names.
Create a loop that runs 6 times:
Inside of the for loop, prompt the user for a name
Append the name to the list
Outside of the for loop, prompt the user for how many people they would like to vote off the island.
Call the function eliminate and pass the variable you used from step 7 to it.
Also, this function will return a value, so store this back function call back to a new variable.
Create a function called eliminate and create a variable to use as the parameter:
Inside the function, randomly shuffle (use the shuffle() method) all the values in the list (you will need to import random at the top of the program)
Then using a for loop, loop it as many times as the value that was passed to the function:
Inside the for loop, remove one name from the list (use the pop() method)
Outside the for loop, but still inside the function, return the list of remaining people
Underneath where you left off in step 8, print the remaining people that are left: those that did not get voted off the island.
WILL GIVE BRAINIEST!

Answers

Answer:

#################

# Python Practice

#################

# Part 1

# ------------------------------------------------------

run_compare = 3

ran_compare = 0

while run_compare != ran_compare:

   num1 = int(input('Please input the first number: '))

   num2 = int(input('Please input the second number: '))

   def compare(number1, number2):

       if number1 < number2:

           print(f'{num1} is less than {num2}')

       elif number1 > number2:

           print(f'{num1} is greater to {num2}')

       else:

           print(f'{num1} is equal than {num2}')

   compare(num1, num2)

   ran_compare += 1

# ------------------------------------------------------

# Part 2

run_name = 6

ran_name = 0

names = []

# ------------------------------------------------------

while run_name != ran_name:

   name = input(str('Please insert a name: '))

   names.append(name)

   print(names)

   ran_name += 1

# ------------------------------------------------------

give me a second im going to resolve the last part but this is what i have so far

Following are the program to the given question:

Program Explanation:

Import random package as r.Defining a method "compare" that takes two variable "n1,n2" inside the parameter.In the next step, a conditional statement is declaed that checks the parameter value and prints its value. Defining a method "eliminate" that takes two variable "n, names" inside the parameter.It calls the shuffle method, and define a for loop that removes names value and return its value.In the next step, a for loop is defined inside this two variable "i1, i2" is declared that inputs value and calls the comapre value.In the next line, an empty list "names" is declared inside this a for loop is defined that inputs name value and calls the "eliminate" method and print its calculated value.

Program:

import random as r#import package random

def compare(n1, n2):#defining a method compare that takes two parameters  

   if n1<n2:#defining if block that checks n1 value less than n2 value

       print("{} is less than {}".format(n1, n2))#print value with the message

   elif n2<n1:#defining if block that checks n2 value less than n1 value

       print("{} is less than {}".format(n2, n1))#print value with the message

   else:#defining else block

       print("{} and {} are equal".format(n1, n2))#print value with the message

def eliminate(n, names):#defining a method eliminate that takes two parameters

   r.shuffle(names)#calling the shuffle method

   for i in range(n):#defining a for loop that checks n values

       names.pop()#calling pop method to remove value

   return names #return a names value  

for i in range(3):#defining a for loop that inputs value

   i1 = int(input("Enter an integer: "))#defining i1 value to input value

   i2 = int(input("Enter another integer: "))#defining i2 value to input value

   compare(i1, i2)#calling the compare method  

   print()#using print to break line  

names= [] #defining an empty list      

for i in range(6) :#defining a loop that inputs name value

   name = input("Enter name: ")#defining name variable that inputs value

   names.append(name)#calling append method  

n = int(input("\nHow many people you would like to vote off the island: "))#defining n variable that input value

new_names = eliminate(n, names)#defining new_names that calling eliminate method

print("\nRemaining people that did not get voted off the island:")#print message

if(len(new_names) != 0):#defining if block that checks new_names length not equal to 0

   for name in new_names:#defining a for loop that checks name is in new_names

       print(name)#print name value

else:#defining else block  

   print("None")#print message None

Output:

Please find the attached file.

Learn more:

brainly.com/question/21922031

April is worried that she is not a "good speller" so she plans to let the spelling checker correct all her mistakes. What would be the most helpful advice for April?​

Answers

Answer:

Likely, the best option would be to use the "auto-correct" function found on Microsoft Word or Google Docs. There are other forms of spell-checking such as Grammarly or by using a dictionary.

Explanation:

They have tools meant for checking for grammatical errors and can be used to better enhance your overall writing.

Show the dynamic and speculation execution for the following code

Add F2,F3,F4
Loop : Lw F2,0(R1)
Subi R1,R1,8
Div F9,F10,F11
Sw F9,5(R2)
Bne R1,Loop




- 1 Fp & 1 Int operation can issue at the same cycle
- 3 execution stage
- 2 commit stage
- FP : 2 cycle
- Lw : 2 cycle
- ALU : 3 cycle
- Two iteration

Answers

Answerf9,f10,fll

Explanation:

The type of device which is 3 ½ inch floppy drive is​

Answers

Answer:

That would be known as a floppy disk(literally)

Explanation:

It is a removable magnetic storage medium. They are used for moving information between computers, laptops or other devices.

A device is sending out data at the rate of 1000 bps. How long does it take to send
out (a)10 bits, (b) a single character (8 bits) and (c)100,000 characters?

Answers

Answer:

0.01 second ; 0.008 seconds; 800 seconds

Explanation:

Given that:

Sending rate = 1000 bps

Rate of 1000 bps means that data is sent at a rate of 1000 bits per second

Hence, to send out 10 bits

1000 bits = 1 second

10 bits = x

1000x = 10

x = 10 / 1000

x = 0.01 second

2.)

A single character 8 - bits

1000 bits = 1 second

8 bits = (8 / 1000) seconds

= 0.008 seconds

3.)

100,000 characters = (8 * 100,000) = 800,000

1000 bits = 1 second

800,000 bits = (800,000 / 1000)

= 800 seconds

The New Slide command on the Ribbon lets you choose ________.
Question 3 options:

slide dimensions

print settings

slide layouts

transitions

Answers

Answer: slide layouts

Explanation:

Just took the test hope this helps ❤️✨

The New Slide command on the Ribbon lets you choose slide layouts. Thus, option C is correct.

What is  New Slide?

Make your arrangement selection in the New Slide message box for your new presentation. Study slide layouts in more detail. Choose Add Slide. That new slide has now been added, allowing you to start adding information by clicking within a placeholder.

You may select slide patterns using Ribbon's New Slide command. To have the new slide display just below the selected slide there in the slide window, click on that slide. On the Insert tab, in the Slides grouping, choose the New Slide option.

The fresh slide needs to be displayed beneath the current slide. Select the initial of the two rolls and initiatives Slide to insert a new slideshow seen between existing ones. Therefore, option C is the correct option.

Learn more about  New Slide, here:

https://brainly.com/question/1372598

#SPJ2

A value chosen by the responder to identify a unique IKE SA is a _________.
A. Initiator SPI
B. Responder SPI
C. Flag
D. Message identifier

Answers

Answer:

Responder SPI

Explanation:

Responder SPI : Cookie of an individual referring to an application from the SA organization, a message from the SA, or a delete from the SA.

How many times will line 7 be executed when the following code is run?


String str = "rebellion";

int i = 0;

int j = str.length() - 1;

String result = "";

while (i < j)

{

result = str.substring(i, i + 1) + result + str.substring(j, j + 1);

i++;

j--;

}

System.out.println(result);
(Java)

Answers

Answer:

4 times

Explanation:

Required.

How many times will line 7 be executed?

Line 2 initialises i to 0

Line 3 subtracts 1 from the length of "rebellion" , the result of the subtraction is then saved in J

So:

j = 9 - 1

j = 8

From line 2 and line 3, we have that:

i = 0 and j = 8

Line 4 is an iteration that is repeated as long as i is less than j

Line 7 will be executed, for the first time as: i < j because 0 < 8

i is incremented to 1 and j is reduced to 7

Line 7 is then executed again, the second time because 1 < 7

i is incremented to 2 and j is reduced to 6

Line 7 is then executed again the third time because 2 < 6

i is incremented to 3 and j is reduced to 5

Line 7 is then executed again the fourth time because 3 < 5

i is incremented to 4 and j is reduced to 4

At this stage, line 7 will no longer be executed because I is no longer less than as 4 = 4.

Hence, number of execution is 4 times

explain the major innavotions made from the establishment of abacus​

Answers

Answer:

The abacus is one of many counting devices invented to help count large numbers.

Explanation:

What is the name of the variable in the
following code?

Answers

Answer:

Lift

Explanation:

When coding, you use a variable name for an object, and assign it to move up, down, and/or sideways.

Lift is the answer for that

write a an algorithm to find out volume?​

Answers

This for the algorithm of a sphere:
Define the radius of the sphere.
Define the pie and assign (22/7)
Calculate the volume of the sphere as (4/3)*pie*r3
Assign the volume of the sphere to volume_of_sphere.
Print the volume of the sphere.

who here plays overwatch or paladins ps4? I'm getting overwatch soon and need people to play with. please don't report this.​

Answers

Answer:

I'm down to play

Explanation:

fast guys can u tell its answer
find the count of value from cells a5 through e12

Answers

Answer:

See the bottom status bar of excel, it will show the average, count and sum of values in the selection.

Select the correct answer. Which type of computer application is Apple Keynote? OA. word processor O B. spreadsheet O C. presentation OD. database O E. multimedia

Answers

Answer:

Apple Keynote is presentation Software

The correct option is C

Explanation:

Now let explain each option

Word processor:

Word processor is incorrect because it is used to type text, format it add tables and figures, For example MS Word

Spread Sheet:

Spread Sheet is incorrect as it is used for calculation. Like MS Excel

Presentation:

Key tone is a presentation software. it is used to make presentation and add animation and transition to it.

Database

Database is incorrect because databases are used for storing data. Not for presentation.

how do you evaluate the use of the navigational aids and technology

Answers

Explanation:

A navigational aid or AtoN or navaid is any sort of marker that guides to mark safe waters and also help mariners in determining their position with respect to land or any navigational hazard or hidden danger. Traditionally aids to navigation have been physical aids such as lighthouses, buoys and beacons

cutting of trees is bad or not bad​

Answers

It is bad cutting tree :(

Answer:

bad

Explanation:

it gives out air and oxygen

Having too much b-roll footage is often a problem for editors

True
False

Answers

verdade pois tem muita filmagem e é dificil escolher a melhor imagem

The material inspection and recieving report the multi-purpose document that serves as evidence of inspection and acceptance, shipping document, receiving document, and contractor invoice is designated as the:________.

Answers

Answer:

DD Form 250

Explanation:

DD Form 250 which is an acronym for Department of Defense Form 250.

It is the Material Inspection and Receiving Report that is used for contracts supplies and services including acquiring noncommercial commodities such as:

1. Acknowledgment of equipment by the Government

2. Contractor's invoice for expense.

3. loading record for hauling and acquiring.

4. Proof of Government Quality assessment.

Hence, in this case, the correct answer is DD Form 250.

The OpenMP critical-section compiler directive is generally considered easier to use than standard mutex locks, because

Answers

Complete question

A) management of entry and exit code is managed by OpenMP library reducing the possibility of programming errors.

B) programmers don't need to worry about race conditions.

C) a thread cannot block inside a critical section.

D) deadlock cannot occur.

Answer:

A. Management of entry and exit code is managed by OpenMP library reducing the possibility of programming errors

Explanation:

This is a multiple choice question and this is the answer because:

1. OpenMp is inclusive of an APL/compiler directives:

2. any code which follows #pragma omp parallel is a parallel region and it is performed by large number of threads that are same as the number of processing cores that are in the system.

3. The critical-section compiler directive acts more like a binary semaphore or mutex lock,it makes sure that only one thread is active in the critical section at the same time.

The attenuation of a signal is -10 dB. What is the final signal power if it was originally
5 W?

Answers

Answer:

P₂ = 0.5 W

Explanation:

It is given that,

The attenuation of a signal is -10 dB.

We need to find the final signal power if it was originally  5 W.

Using attenuation for signal :

[tex]dB=10\text{log}_{10}(\dfrac{P_2}{P_1})[/tex]

Put dB = -10, P₁ = 5 W

Put all the values,

[tex]-10=10\text{log}_{10}(\dfrac{P_2}{5})\\\\-1=\text{log}_{10}(\dfrac{P_2}{5})\\\\0.1=\dfrac{P_2}{5}\\\\P_2=5\times 0.1\\\\P_2=0.5\ W[/tex]

So, the final signal power is 0.5 W.

The final signal power if it was originally 5W is; 0.5 W

Signal Power

We are given;

Attenuation signal; dB = -10 dBOriginal signal power; P1 = 5 W

Formula for attenuation signal is;

dB = 10log_10_ (P2/P1)

Where P2 is final signal power

Thus;

-10 = 10log_10_(P2/5)

-10/-10 = log_10_(P2/5)

-1 = log_10_(P2/5)

0.1 = P2/5

P2 = 0.1 × 5

P2 = 0.5 W

Read more about signal power at; https://brainly.com/question/13315405

A junior account manager owns an account and creates a new opportunity to manage a complex deal. She needs the help of the product specialist and solution engineer.
Given the size of this deal, she knows the account is likely to be reassigned to a senior Account manager in the near future.

What is the optimal way for the Junior Account manager to share the opportunity, given the private sharing model?

Manual share on the account
Opportunity Team
Manual share on the opportunity
Create owner-based sharing rule

Answers

Answer:  I'd say She should share by Email, Text, or call.

A(n) __________ records the activities of computer operators surrounding each event in a transaction.
A. threat analysis
B. audit trail
C. DNA profile
D. expert systems analysis

Answers

Answer:

B. audit trail

Explanation:

A(n) audit trail records the activities of computer operators surrounding each event in a transaction.

I believe the answer is b

How much data can a flash drive store?​

Answers

Answer:

depends on which flash drive

Explanation:

32GB-1000 photos

Well, It just depends on which size you get. You could get a 512 MB or 10 GB. I prefer somewhere in the middle because I don't need to store a lot of stuff in my Flash drive.

Explain to Alana why she might not want to blast her boss on social media just yet.

Answers

Answer: She might get fired. And who knows, if she doesn't, she might get a raise!

Create a Java program that takes input of a list of integers from the user, stores them into an array and then finally uses the array contents to output the list of integers in reverse. The user's input begins with the number of integers to be stored in the array. For coding simplicity, follow each output integer by a space, including the last one. Assume that the list will always contain fewer than 20 integers.

Answers

Answer:

This question is answered using Java

import java.util.*;

public class Main{

public static void main(String[] args) {

 Scanner input = new Scanner(System.in);

 System.out.print("Length of array: ");

 int len = input.nextInt();

 int[] intArray = new int[len];

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

     intArray[i] = input.nextInt();

 }

 for(int i = len-1; i>=0;i--){

     System.out.print(intArray[i]+" ");

 }

}

}

Explanation:

This line prompts user for length of array

 System.out.print("Length of array: ");

This gets the length of the arrau

 int len = input.nextInt();

This declares the array as integer

 int[] intArray = new int[len];

The following iteration gets input to the array

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

     intArray[i] = input.nextInt();

 }

The following iteration prints the array in reversed order

 for(int i = len-1; i>=0;i--){

     System.out.print(intArray[i]+" ");

 }

Helen is working on her colleague’s photos. She came across this particular photo and was confused about which effect the photographer had used in the photo. Can you help her figure out the effect?
The effect used in the photo is

Answers

Answer:

it could be Tilt-shift - Tilt-shift effect - or Miniature faking.

Explanation:

Fill in the blank are always hard when the system has a set answer. But photographers commonly use the tilt-shift effect to focus on a certain part of the image while blurring the rest of the photograph. They refer to this as selective focus. You can use the tilt-shift effect and selective focus for miniature faking. This is where the subjects in the photograph appear miniaturized. Hope this helps

Answer: tilt-shift

Explanation:

Multi-part question:

Part 1:

Use MySQL Workbench to create an EER model for a database that stores information about the downloads that users make. (When you create the EER model, it will be given a default name of mydb. For this exercise, it’s not necessary to change this name.) Define the tables that are necessary to implement this data structure:

Each user must have an email address, first name, and last name.

Each user can have one or more downloads.

Each download must have a filename and download date/time.

Each product can be related to one or more downloads.

Each product must have a name.

When you’re done defining the tables, create a diagram for the database. Then, use the diagram to define the required relationships. When you do that, be sure to use the relationship button that uses existing columns.

Part 2:

Create a view named order_item_products that returns columns from the Orders, Order_Items, and Products tables.

This view should return these columns from the Orders table: order_id, order_date, tax_amount, and ship_date.

This view should return the product_name column from the Products table.

This view should return these columns from the Order_Items table: item_price, discount_amount, final_price (the discount amount subtracted from the item price), quantity, and item_total (the calculated total for the item).

Part 3:

Write a SELECT statement that uses the view that you created in part 2 to get total sales for the five best selling products. Sort the result set by the order_total column in descending sequence.

Answers

Answer:

part 1:

Explanation:

What does Stand for in web design

Answers

Answer:

g

Explanation:

h

8. T/F: At the bottom of a slide you are working on you can enter notes to indicate what yo
True
False
« BACK
LESSON 8.1 - INTRO TO PRESENTATIONS

Answers

Answer: True. Hope it helps!

Which of the following are risks to a network?
a Sending emails
b. Granting administrator access to a non-administrator
c. Opening files from unknown senders
d. Unwanted advertisements

Answers

Answer:

option  b and c are correct answers.

Explanation:

Let see each option in detail.

a) Sending email is not a risk.

b) Granting access is a problem because the other person can undermine the network

c) Unknow senders can send virus or other malicious code to corrupts you data.

d) Unwanted advertisement is not a big deal.

Answer:

Granting administrator access to a non-administrator  

 Opening files from unknown senders

Explanation:

Psst those are the answers

Other Questions
NOO THESE PEOPLE TOOK AWAY ALL MY POINTS!!!! I USED TO HAVE LIKE 3000 AND IVE BEEN USING BRAINLY FOR LIKE 10 HOURS AND THEY TOOK IT ALL AWAY!!!! what is a abigail williams motivation This company purchased a truck at a cost of $12,000. The truck has an estimated residual value of $2,000 and an estimated life of 5 years, or 100,000 hours of operation. The truck was purchased on January 1, 2012, and was used 27,000 hours in 2012 and 26,000 hours in 2013. Refer to Fabian Woodworks. If the company uses the units-of-production method, what is the depreciation rate per hour for the equipment solve for x. solve for x. solve forx. Answer this please and fast can anyone help me thanks ggg The mean number of robberies per month in a certain town is 3. What is the probability that in any given month 5 robberies will occur in this town?0.010.140.2650.916 3. Hayden Company currently sells widgets for $160 per unit. The variable cost is $60 per unit and total fixed costs equal $240,000 per year. Sales are currently 40,000 units annually, and the income tax rate is 40 percent. Required: a. Calculate the contribution margin per unit. Considerando las siguientes variables a = ancho y l = longitud, determina su valor, si se sabe que se cuenta con un rectngulo que tiene como permetro 35 metros, y se sabe que el doble de su ancho es igual a 3 veces su longitud. Explain why the world population is growing, even as the growth rate is decreasing. Can u correct this sentence I failed the quiz because I mispelled too many words. PLEASE HELP ASAPThe graph of which function has an axis of symmetry at x = one-quarter?A: f(x) = 2x2 + x 1B: f(x) = 2x2 x + 1C: f(x) = x2 + 2x 1D: f(x) = x2 2x + 1 How did Japan react to the economic impact of the Great Depression? 11. How did you use eye contact, the volume of your voice, clear pronunciation,speaking rate, or other means to connect with others during the discussion? 20 POINTS SEND HELP PLEASE One way to overcome generational distinctions is to ______.a.Acknowledge that men and women can do tasks equally wellb.Tolerate ideas that come from different culturesc.Listen carefully for ideas everyone can agree ond.Favor the habits of one generation over anotherPlease select the best answer from the choices providedABCD fill in the blanks triple jump lading area length is........... In what ways did the invention of the ironclad warship change naval warfare? In what ways do you follow a healthy diet? How much is 2% of 3.50 What is the perimeter of a square with sides 2.5 mm long?A 7.5 mmB 10 mmC 2.5 mmD 5 mm