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
The line plot shows the amount of water collected after seven days of an experiment. Tina decides to evenly divide the water int
allochka39001 [22]

Answer: my brother did it and it's 1 cup

Step-by-step explanation:

6 0
3 years ago
Read 2 more answers
Solve for n. −5/6n=40 What is the answer <br><br> A.−56<br><br> B.−48<br><br> C.48<br><br> D.56
stiv31 [10]
It should be -48. Multiply 40 by the reciprocal and simplify.
7 0
4 years ago
Read 2 more answers
Plzz help i need to defeat a boss
maw [93]

Answer:

4.78 m

Step-by-step explanation:

From cm to m, you would need to divide 100 to get your conversion answer which is 4.78 m.

5 0
3 years ago
3+ 5/4:10/6?????????????
Gala2k [10]
Your final ratio would be 17/4: 5/3.

    5         5    
 -------   ------
    4         4

+  3        12
 -------   ------
    1         4
------------------------
          17
        -------
           4



     10  ÷ 2     5
   ------- ⇒  --------
      6   ÷ 2     3
6 0
4 years ago
Please help me someone.!!!!!!!!!!!!!!!!!!!!
yan [13]

Answer:

y=-|x|+2

Step-by-step explanation:

The y-intercept is 2 and the line of symmetry is the y-axis.

4 0
3 years ago
Other questions:
  • all my digits are different the product of my digits is not equal to zero all of my digits are square numbers my units digit is
    14·1 answer
  • PLEASE HELP ASAP !!!! <br> Samantha says that (6^4)^-3 = 6. is she correct ? why or why not ?
    5·1 answer
  • Find the volume of the given prism. Round to the nearest tenth if necessary.
    9·2 answers
  • At a basketball game, for every 2 baskets team A scored, team B scored 3 baskets. The ratio of the number of baskets scored by t
    5·2 answers
  • What should be multiplied on both sides to solve the following equations 2/9x=3/4?
    13·1 answer
  • darren drove his car 96 miles and used 4 gallons of gasoline . what is the unit rate for miles per gallon
    9·2 answers
  • What is the inverse of the function f(x)=1/4x-12?
    15·1 answer
  • PLS HELP 23 points!!!!!!!
    6·2 answers
  • suppose a normal distribution has a mean of 120 and a standard deviation of 10. What is P( x&gt;= 100)?
    6·1 answer
  • Smartphones have chips in them that can contain 3.3 billion transistors. If each transistor weighs 5.1 × 10−23 grams, find the t
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!