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
Venus's orbital distance from the Sun is 0.72 AU. How long does it take for Venus to complete one orbit around the Sun, compared
qwelly [4]

Answer:

224.7 days

Step-by-step explanation:

Venus is the second planet out of the nine planets and it precedes the planet earth. Venus has an orbital distance of 0.72 AU from the sun while Earth has an orbital distance of 149.60 million km from the sun. Due to these distances, the Venus completes one orbit around the sun in 224.7 days while the Earth complete one orbit around the sun in 365.256 days but in a leap year, it completes one orbit around the sun in 366 days.

8 0
3 years ago
Kevin draws a figure that has four sides.All sides have the same length.His figure has no right angles.What figure does Kevin dr
svetoff [14.1K]
Rhombus or diamond I think. I hope that this helps!
5 0
3 years ago
What are the 5 infinitives?
Ymorist [56]

The five types of infinitives are full infinitives, bare infinitives, split infinitives, continuous infinitives , and perfect continuous infinitive.

Explanation:

Types of infinitives:

Five types of infinitives are as follow:

  • Full infinitives : Add 'to' Infront of the verb to complete the the situation.
  • Bare infinitives: here " to" get omitted from the sentence.
  • Split infinitives : Here adjectives slides between infinitives marker.

To hear : full infinitives changes to split infinitives : to slowly hear.

  • Continuous infinitives: Action going for certain period of required time.

Example : to be missing

  • Perfect continuous infinitives: prior to a time :

Example : to have seen

Therefore, there are are five types of infinitives .

Learn more about infinitives here

brainly.com/question/1219442

#SPJ4

5 0
1 year ago
Can someone help with this equation?
Setler [38]

Answer:

OK what is equation ??????

6 0
3 years ago
What is an equation of the line that passes through the point (-4, -6) and is
const2013 [10]
Answer:y=2/3x-10/3
- 4/-6 is 4/6 so m is 4/6 then fill in the x and y variables in y=Mx+b solve for b then start plotting the equation of the line to check and you get your answer

I think this is the answer you might need to check again with more people
8 0
2 years ago
Read 2 more answers
Other questions:
  • What is the Value of m<br> 3m + 5 = 14
    12·2 answers
  • 9% of what equals 4.5
    11·2 answers
  • Giving away brainliest (assuming there is more than one person answering, of course)
    14·1 answer
  • Carpet is sold in square yards. How much carpet would a person need to buy for a rectangular room that has dimensions of 10 yard
    13·1 answer
  • How to convert 147.9 price per liter to price per gallon 
    11·2 answers
  • In physics, it is important to use mathematical approximations. for instance, in a small angle approximation, tanα ∼ sin α . fin
    15·1 answer
  • You and a friend each randomly draw a card from a standard deck. What is the probability that at least one of you is holding a f
    13·2 answers
  • A textile fiber manufacturer is investigating a new drapery yarn, which the company claims has a mean thread elongation of 12 ki
    7·1 answer
  • What numbers add up to four and multiply to 9?
    6·1 answer
  • K(x)= -3x - 3; find k(-2)
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!