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
Frank has a compass but no straightedge. Which of the following can Frank construct with just the compass?\
oksian1 [2.3K]

Answer:

A and D

Step-by-step explanation:

3 0
3 years ago
The length of the base and the height of a triangle are numerically equal. Their sum is 6 less than the number of units in the a
Troyanec [42]
Base = Height, Let them be x.

( x \times x) \div 2 = (x + x) + 6 \\ x ^{2} \div 2 = 2x + 6 \\ \frac{1}{2} x^{2} - 2x - 6 = 0
Solve quadratic equation:
x=6, x=-2(rejected because base and height is positive)

6x6/2 =18
6 0
3 years ago
Liam paid $13. 00 at a department store for 5 pairs of socks. When the number of pairs of socks is represented by p and the tota
Darina [25.2K]

.Brainliest please

Answer:

B. c = 2.6

Step-by-step explanation:

$13.00 / 5 = 2.6

7 0
3 years ago
James has $3,250 saved for his trip to France. The plane
Aleksandr-060686 [28]

Answer:

7 days

Step-by-step explanation:

7 0
3 years ago
What comes next in the pattern?12,16,20<br>A. 10<br>B. 22<br>C. 23<br>D. 24​
kolezko [41]
24 , it’s just skipping four letters up
7 0
3 years ago
Other questions:
  • The graph below shows the price of different numbers of hats at a store:
    13·1 answer
  • Quadrilaterals are squares
    13·1 answer
  • patty bought a shirt for $14.50 plus9% tax. ales bought a sweater for $22.95 plus 9% write the sum in dollars that patty and ale
    11·1 answer
  • What is the order of the numbers from least to greatest? A = 4.6 x 10–4 B = 2.4 x 10–3 C = 3.5 x 105 D = 6.3 x 10–4 A. C &lt; A
    8·1 answer
  • Hey, please help solve the question.​
    10·1 answer
  • Evaluate the expression.<br><br><br>33 + 6( 2 + 36)
    5·1 answer
  • Yoga Fun charges a $63 starting fee plus $12 per class. Yoga For All charges no starting fee and $15 per class. For how many cla
    12·1 answer
  • Answer to 3 copies of 1/3=
    7·2 answers
  • A triangle has sides with lengths of 4 inches, 8 inches, and 9 inches. Is it a right triangle?
    5·2 answers
  • Help..........................
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!