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
there is a beaker of 3.5% acid solution and a beaker of 6% acid solution in the science lab. Mr. Larson needs 200ml of 4.5% acid
disa [49]
Below are the choices:

A. 80 mL of the 3.5% solution and 120 mL of the 6% solution 

<span>B. 120 mL of the 3.5% solution and 80 mL of the 6% solution </span>

<span>C. 140 mL of the 3.5% solution and 60 mL of the 6% solution </span>

<span>D. 120 mL of the 3.5% solution and 80 mL of the 6% solution
</span>
Let fraction of 3.5% in final solution be p. 

<span>p * 3.5 + (1 - p) * 6 = 4.5 </span>

<span>3.5p + 6 - 6p = 4.5 </span>

<span>2.5p = 1.5 </span>

<span>p = 3/5 </span>

<span>3/5 * 200 = 120 </span>

<span>Therefore the answer is B. 120 ml of 3.5% and 80 ml of 6%.</span>

6 0
3 years ago
Find the domain and range of the function graphed below. Write your answers in interval notation.
Rudik [331]

Answer:

  • Domain: [-2, 3)
  • Range: (-5, 4]
  • Is the relation a function? - Yes

Step-by-step explanation:

The domain is the set of x-values and the range is the set of y-values.

A relation is a function if each value of x maps onto no more than one value of y.

3 0
2 years ago
A bag contains 6 red marbles, 4 blue marbles, 7 green marbles, and 3 yellow marbles. A marble is drawn from the bag and is not r
Alinara [238K]
20 total marbles....7 are green

probability on first draw is 7/20...and since the marble was not replaced, the probability on the second draw is 6/19. And since they cant happen at the same time, we multiply

7/20 * 6/19 = 42/380 which reduces to 21/190

3 0
3 years ago
Read 2 more answers
2d+4=10+2.5d<br><br> Help Me
sergiy2304 [10]
Subtract 2d from both sides

simplify 10 + 2.5d - 2d to 10 + 0.5d

subtract 10 from both sides

simplify 4 - 10 to -6

divide both sides by 0.5

simplify 6/0.5 to 12

switch the sides

Answer: d = -12.
6 0
3 years ago
(10 times 2) + 5 times 8 =
DerKrebs [107]
The answer is 60 because 10 x 2 is 20 and 5 x 8 is 40 and add those together to get 60
7 0
2 years ago
Other questions:
  • Identify the appropriate mixed number for the picture shown.
    13·1 answer
  • How do you <br>simplify 1-4(u-1)
    15·1 answer
  • A.
    7·1 answer
  • An endpoint of a line segment is (4,5) and the midpoint of the line segment is (3, -2). Find the other endpoint.
    5·1 answer
  • What is the value of -19- (-18)?
    13·2 answers
  • Susan borrowed $19 from her brother. She paid him back $3 the next day. She will then give him $4/week to pay off the debt. How
    14·2 answers
  • Simplify 79.5-2.58 x (3.63-1.63) to the third power
    14·1 answer
  • Only need help on 30 and 36!!! please help 7 grade math
    13·2 answers
  • Write a formula for fogoh, where f(x) = x + 1, g(x) = - 3x, and h(x) = 5 - X.<br> (fogoh)(x) =
    9·1 answer
  • Plsssssssssssssss i need help
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!