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
(-6, -2) &amp; (-8,-6)<br> what’s the slop?
nevsk [136]

Answer:

The slope is 2.

Step-by-step explanation:

1. To find the slope between 2 points, always use:

\frac{Y_{2} - Y_{1}}{X_{2} - X_{1}}

2. Plug in the coordinates:

\frac{-6 + 2}{-8 + 6}

3. Simplify:

\frac{-4}{-2} = 2

4 0
3 years ago
Polimerlerin su ile parçalanarak monomerlerine ayrılmasına ne denir?<br>​
kolbaska11 [484]

Answer:

tarlak iefdiebdid didbdkd

5 0
3 years ago
Lauren is building a tree house with her dad. The dimensions of the floor are 9 feet by 6 feet. What is the area of the floor, m
lbvjy [14]
The area is 6 yrds^2
Hope this helps
3 0
3 years ago
Combine the like to simplify the expression: -5y + 12 + 8y − 6 − 2 =
ANTONII [103]

First, let's move combine like terms:

-5y + 8y = 6 + 2 -12.

3y = -4.

y = -4/3

8 0
4 years ago
Read 2 more answers
Identify the following polygons with the most specific name. Please she jpg for shapes and choices.
ExtremeBDS [4]

Answer:

isosceles trapezoid

Step-by-step explanation:

honestly not 100% sure but it seems the most specific

5 0
3 years ago
Other questions:
  • Write the expression in simplest form using only positive exponents (x^2/3y^-1/2)^-6
    12·1 answer
  • A cookie recipe needs 1 1/3 cups of flour to make 1/2 batch of cookies. How much flour is needed to make 1. batch of cookies?
    9·2 answers
  • If my friend and i went to get ice cream, I have $30 and each ice cream is $5. What equation would help me solve this? I need an
    10·1 answer
  • Plz help with this problem <br><br> 2h*25b^6/8Z^6 <br> simplified
    9·2 answers
  • Working together, Karen and Darren can mow their yard in 40 minutes if they each have a mower and mow at the same time. If Karen
    14·1 answer
  • I have some extra pts so here we go!!
    8·2 answers
  • I need help please fast
    14·2 answers
  • I NEED HELP ASAP PLEASEEE
    13·2 answers
  • 5x-4[7+(2x-4)], for x=-3<br> with shown work please
    8·2 answers
  • Find the unit rate.<br> 30 newspapers in 2 piles<br> =<br> newspapers per pile
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!