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
What is this answer?
gayaneshka [121]

Answer:

3n^2 AKA C would be the answer.

Step-by-step explanation:

Reason: any number 1-9 is a mononomial number. Coefficient of three just means to add a numerical or constant quantity placed before and multiplying the variable in an algebraic expression

5 0
3 years ago
Please tell me what 0.85 = a/-7.2 is. thanks
attashe74 [19]

Your answer would be a=-6.12

6 0
3 years ago
Someone please help me ASAP
Ivanshal [37]

Step-by-step explanation:

a vector multiplied by a scalar is equal to it's image. The expression above gives an equation and after solving, it gives you the image

7 0
3 years ago
If the scale factor of Figure A to Figure B is<br> 7:2, find the perimeter of Figure A.
Daniel [21]

Answer:

  • I honestly don't k ow wish i can help if you can help me with one
6 0
3 years ago
Read 2 more answers
Whay will most likely happen to students test scores if the number of hours they use social media increases? A test score will i
Len [333]
C as when they put more hours into the social media they will study less and less which leads to less test scores
4 0
3 years ago
Other questions:
  • The probability that an event will occur is a fraction 1 0ver 8 which of these best describes the likelihood the event will occu
    7·1 answer
  • A point P is located in a two dimensional cartesian coordinate system at x = 4.3 cm &amp; y = 3.6 cm. Calculate the angle in deg
    10·1 answer
  • Yuma needs a singer. Singer A is offering her services for an initial $50 in addition to $20 per hour. Singer B is offering his
    8·1 answer
  • Find the value for x:
    5·2 answers
  • 30 POINTS!!!
    7·1 answer
  • ou invested 7000 between two accounts paying 4% and 9% annual​ interest, respectively. If the total interest earned for the year
    14·1 answer
  • Please help me i'll give brainliest
    8·2 answers
  • Katoomba Scenic Railway in Australia is the steepest railway in the world. The railway makes an angle of about 52 degrees with t
    13·1 answer
  • Subtract.
    6·1 answer
  • What is the surface area of a sphere with radius 3?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!