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
Factor 42v^3 – 21v^2 + 34v – 17
BartSMP [9]

Answer:

(2v-1)(21v^2+17)

Step-by-step explanation:

add and subtract the second term to the expression and factor by "grouping"

answer should be:

(2v-1)(21v^2+17)

4 0
4 years ago
Help..................
Mariana [72]
Problem A,B,C, and D can be solved using 3*6=18 or 6*3=18
4 0
3 years ago
Read 2 more answers
Evaluate <br> h(x) = 17+ x/6<br> H(-18)=
yan [13]
The answer is 14

-18/6 is -3. add that to 17 and you get 14.
7 0
3 years ago
If billy can read 2 pages in 6 minutes, how many pages can he read in 24 minutes?
german

Answer:

8 mins

Step-by-step explanation:

First you see how many mins he can read on 1 page than you divided the number by 24 to get your answer.

8 0
3 years ago
Compare Decima<br> 2.48 [. ] 2.53<br><br> I need help finishing if this is a &lt;,&gt; or =
lorasvet [3.4K]

Answer: <

Step-by-step explanation:

2.48 < 2.53

7 0
4 years ago
Other questions:
  • Please help explain each problem thank you have a great day
    5·1 answer
  • angela is buying a dress that is on sale for 20% off. if the original price of the dress is $40.00, how much money is angela sav
    7·2 answers
  • Simplify the expression: 52 – [30 – 2(7 – x)].
    15·1 answer
  • Find the y-intercept of the parabola whose equation is f(x)=-2x^2-8x+5
    10·1 answer
  • The length of a rectangle is four times it width. If the perimeter of the rectangle is 70 ft, find its length and width
    8·1 answer
  • Please help me on this
    5·1 answer
  • Find the missing segment in the image below
    9·2 answers
  • De acuerdo con la siguiente figura calcula el ancho del río y la distancia del árbol a la lancha.
    7·1 answer
  • Systems of equations and inequality’s HELP IM BEGGING
    9·1 answer
  • Is urgent please ,The purpose of an initial public offering (IPO) is to do what?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!