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
One positive number is five times another number is the difference between the two numbers is 1676 find the numbers
AleksAgata [21]

Answer:

The two numbers are -419 and -2095.

Step-by-step explanation:

5x=y

x-y=1676

----------------

x-5x=1676

-4x=1676

x=1676/-4

x=-419

5(-419)=y

y=-2095

4 0
3 years ago
Read 2 more answers
Use properties to find the sum or product. <br> 93+(68+7)
erma4kov [3.2K]
93+(68+7)=93+68+7\\use\ commutative\ property: a+b=b+a\\\\=93+7+68\\use\ associative\ property:a+(b+c)=(a+b)+c\\\\=(93+7)+68=100+68=\huge\boxed{168}
6 0
3 years ago
I have been on this question for so long if anyone can help me I would greatly appreciate it. Thank you
Phoenix [80]

Answer:

Step-by-step explanation:

let x be the number

2(x+8)=-4x+4

2x+16=-4x+4

6x=-12

x=-2

8 0
3 years ago
Read 2 more answers
3x^2- 2x has no c term. That means c = 0 *<br> TRUE<br> or<br> FALSE?
just olya [345]

F means false so it is not true it is false

4 0
3 years ago
10. When Raphael solved the system below by using the method of elimination, he changed the second equation
kirill115 [55]

Answer:

e we'll

Step-by-step explanation:

second equation

to –8x – 2y =-2. What property justifies this manipulation?

8x + 3y = 7

4x + y =1

4 0
3 years ago
Other questions:
  • F 9 is added to twice a number and this sum is multiplied by 4​, the result is the same as if the number is multiplied by 4 and
    13·1 answer
  • jamil has 3 pet lizards. the pet store owner said that jamil will need to buy a total of 36 crickets to feed his lizards if each
    13·2 answers
  • I need some help with this rational equation. It's supposed to = -1, but for some strange reason I keep getting x^2 +2x = -1.
    14·1 answer
  • If logc81=2 l o g c 81 = 2 , what is the value of c c ?
    15·1 answer
  • Solve for x.2/8+18=4<br>A/-56<br>B/88<br>C/-42<br>D/-70​
    11·1 answer
  • Bronze is an alloy or mixture of the metals copper and tin. The properties of bronze depends on the percentage of copper in the
    8·2 answers
  • What is the circumference of the circle r=4ft
    10·2 answers
  • 4. Factor the binomial.<br> 16x2 – 25
    8·1 answer
  • Graph the line<br> y=-4x+2<br> ‼️will make brainliest‼️
    5·2 answers
  • Violet finds some nickels and pennies under the couch cushions. How much money (in dollars) does she have if she has 140 nickels
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!