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
Kim is drawing a map of the different schools in her school district. She knows that her middle school is 10.6 miles away from t
Tema [17]
4 inches is the answer
7 0
3 years ago
Read 2 more answers
A restaurant adds a 20% tip to the bills of parties of 6 or more people. Suppose a server waits on five such tables. The bill
castortr0y [4]

Answer:

$218.70

Step-by-step explanation:

You need to first convert the percentage to the decimal.

20% = 0.2

Now, you need to find 20% of each bill by multiplying each bill by 0.2.

0.2(185.45) + 0.2(205.20) + 0.2(195.05) + 0.2(245.80) + 0.2(262.00)

Because of the distributive property, you can add up the bills and multiply the sum by 0.2.

0.2(185.45 + 205.20 + 195.05 + 245.80 + 262.00)

0.2(1093.50)

218.7

The waiter made $218.70 in tips.

4 0
3 years ago
The ratio of the interior angles of a triangle is 4:5:7. What are the angle measures?
stich3 [128]

Answer:

45:56.25:78.75

Step-by-step explanation:

a triangle=180º total

4+5+7=16

180÷16=11.25

5 0
3 years ago
Read 2 more answers
Find the value of x
WARRIOR [948]
A i did the test but for me. There was five u could choose from hope this helps
5 0
3 years ago
The figure is a square. it's diagonals meet to form four right angles. what is the approximate value of x ?
Arte-miy333 [17]
The answer is 5.7 to your problem

5 0
3 years ago
Read 2 more answers
Other questions:
  • How much does <br> 4 1/3-2/3
    9·1 answer
  • 6. Minimum value determined by the formula function f (x) = 2x ²-8x + p was 20. Value f (2) is.
    10·1 answer
  • Simplify |-3-81<br> 0 A -11<br> O B. 5<br> O c. 5<br> O D. 11<br> Simplify |-3 - 8|
    11·1 answer
  • The number of medals won by the United States is 26 more than three times the number of medals won by Italy. Write an algebraic
    6·1 answer
  • What is the double of a hundred?
    7·2 answers
  • Need help with this question asap!!
    13·1 answer
  • Зr + #= 7<br> What would the # be for the equation to be r=4
    5·1 answer
  • Tyler saves 17% of his income and he makes $4300 a month. how much will he save?
    7·2 answers
  • A car was traveling 35 miles per hour for a number of hours.
    5·1 answer
  • What is 39,204 divided by 54 step by step​
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!