1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Anton [14]
3 years ago
14

A multiplication problem is provided as a string using the format 'x times y'. Create a function called MultiplyString to extrac

t the numbers that should be multiplied from a character vector called inputCharVect, and then assign the product to the variable multResult.
Mathematics
1 answer:
Varvara68 [4.7K]3 years ago
3 0

Answer:

import java.util.*;

public class MyClass {

   public static void main(String args[]) {

       Scanner scan = new Scanner(System.in);

       System.out.println("Enter your statement: ");

       String inputCharVect = scan.nextLine();

       multiplyString(inputCharVect);        

   }

   

   public static void multiplyString(String input){

       int indexOfWordStart = input.indexOf("t");

       int indexOfWordEnd = input.indexOf("s");

       String firstString = input.substring(0, indexOfWordStart);

       String secondString =input.substring(indexOfWordEnd + 1);

       int firstNumber = Integer.parseInt(firstString.trim());

       int secondNumber = Integer.parseInt(secondString.trim());

       int multResult = firstNumber * secondNumber;

       System.out.println(multResult);

   }

}

Step-by-step explanation:

The first line of the program is the import statement which import Scanner to allow user input. Then, the user input is assigned to inputCharVect, which is then supplied as arguments to the method multiplyString.

The multiplyString method then extracts the index of 't' and 's' which are the start letter for times, then generate a substring, after which it was assigned to firstNumber and secondNumber. The product of firstNumber and secondNumber is assigned to multResult.

You might be interested in
Which statement is true about the end behavior of the graphed function?
Art [367]

Answer:

The correct answer is "As the x-values go to positive infinity the function's value go to positive infinity".

Step-by-step explanation:

If we start analyzing this function at a value of x that is really small, which would be close to negative infinity and we increase the value of x, we will notice that the y-value will also increase. Therefore if we go far into the left, that is, we apply minus infinity to the function we will receive an output that is equal to minus infinity. When the value of x approach 0, the value of the function also approaches 0. Finally when we go far into the right, to positive infinity the function will also go to infinity. Therefore the correct answer is "As the x-values go to positive infinity the function's value go to positive infinity".

8 0
3 years ago
Someone Help me please
OLEGan [10]

Answer:

-1/2

Step-by-step explanation:

3 0
4 years ago
Read 2 more answers
Fill in the missing number to complete the linear equation that gives the rule for this table.
kogti [31]

Answer:

Y=x-5

Step-by-step explanation:

In the table the rule is -5

5 0
3 years ago
Read 2 more answers
Three numbers are in the ratio 1:3:5 and their sum is 270. find the largest number.
Sphinxa [80]

Answer:

<u>150</u>

Step-by-step explanation:

Let :

⇒ The numbers can be denoted as <u>x</u>, <u>3x</u>, and <u>5x</u>

<u />

=============================================================

Solving :

⇒ It mentions their sum is 270

⇒ x + 3x + 5x = 270

⇒ 9x = 270

⇒ x = 30

=============================================================

Largest number :

⇒ 5x

⇒ 5(30)

⇒ <u>150</u>

8 0
2 years ago
Read 2 more answers
Algebra 2- Common Functions PLEASE HELP!
RoseWind [281]

Answer: B

Step-by-step explanation:

Intersection of the 2 parts of the function is (0,0):

==> not A

the second part of the function is an half-line (and x =0)

Answer B

7 0
3 years ago
Other questions:
  • Ava collects 9 insects in her net issac collects 8 more then Ava how many insects does Isaac collect
    13·2 answers
  • What multiplies to 20 and adds up to 9?
    13·2 answers
  • Round the following numbers: 14.45 8.05
    7·2 answers
  • a bottle filled with weighs 42 pounds If the water by itself weighs 11 times as much as the bottle, what is the weight of the bo
    14·1 answer
  • -12÷3×(-8 +(-4)^2 -6)+2<br><br>Please explain in detail.
    9·2 answers
  • When the angle of elevation to the sun is 28 degrees, a flagpole casts a shadow that is 42.5 ft long. What is the
    6·1 answer
  • Please hurry I will brainliest
    14·1 answer
  • Sheila either walks or cycles to school. The probability that she walks is 0.65, is she walks the probability she is late is 0.4
    7·1 answer
  • OFFERING DECENT AMOUNT OF POINTS PLEASE HELP
    13·1 answer
  • When Johan calculates how much interest he must pay, he calculates as follows: SEK 0.045-620,000 = SEK 6,975/4
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!