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
The volume of a cube is 64 cubic inches. Which expression represents s, the length of a side of the cube?
vlabodo [156]

Answer:

<h2>Therefore the length of a side of a cube is \sqrt[3]{64}\ or\ 4</h2>

Step-by-step explanation:

The volume of a cube is expressed as L³ where L is the length of each side of the cube.

Given volume of a cube = 64in³

On substituting;

64 = L³

Taking the cube root of both sides to determine L we have;

\sqrt[3]{64} = (\sqrt[3]{L})^{3}\\\sqrt[3]{64} = L\\L=4

Therefore the length of a side of a cube is \sqrt[3]{64}\ or\ 4

8 0
3 years ago
Expand the expression using the Binomial Theorem and Pascal's Triangle: (3x-1)^3
Readme [11.4K]
(3x)^3+3(3x)^2*-1 +3(3x)(-1)^2+(-1)^3 then simply that down to 27x^3-27x^3+9x-1
6 0
3 years ago
What is the result of 96 divided by 6?8 12 16 or 32
hram777 [196]
96 divided by 6 is 16

96 divided by 8 is 12

96 divided by 12 is 8

96 divided by 16 is 6

96 divided by 32 is 3
8 0
3 years ago
Read 2 more answers
Write the ratio 69 : 75 as a fraction, a decimal, and a percent
dexar [7]

Answer:

69.75 6975/100 92%

Step-by-step explanation:

5 0
3 years ago
A certain triangle has a 30° angle and a 60° angle. Which must be a true
sleet_krkn [62]

Answer:

Step-by-step explanation:

7 0
2 years ago
Other questions:
  • Or is it d). 792 in^2
    11·1 answer
  • PLEASE HELP
    5·1 answer
  • Select the correct difference. 5d 2 + 4d - 3 less 3d 2 - 2d + 4 2d2 + 2d + 1 2d2 + 6d - 7 2d2 + 6d + 7 -2d2 - 6d + 1
    14·2 answers
  • 1.11 People fit comfortably in a 5 feet by 5 feet area. Use this value to estimate the size of a crowd that is 5 feet deep on BO
    12·1 answer
  • Please answer correctly !!!!! Will mark Brianliest !!!!!!!!!!!!!!
    9·2 answers
  • Write an equation in point-slope form of the line that passes through the point (2, -8) and has a slope of 4. The equation is y-
    6·1 answer
  • Pls i need help rn this is due REALLY soon pls thank you
    12·2 answers
  • A taxi charges $1.75 plus a free of $0.75 for each mile traveled the total cost of a ride without a tip is, $4.75. How many mile
    14·2 answers
  • Someone help please
    13·1 answer
  • 8 1/8 i need help please
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!