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
1. A right triangle is shown.
Free_Kalibri [48]

Answer:

24 is the answer

Step-by-step explanation:

answer is 24 for base

7 0
3 years ago
Which is bigger 4lb or 60 oz
Bond [772]

the answer should be 4 lbs

hope this helps

let me know please

4 0
3 years ago
Can someone help me with this.​
solong [7]
The answer to this question is 8-2.
7 0
3 years ago
I was at the store, and saw two sizes of avocados being sold. The regular size sold for $0.84 each. For what prices would the la
JulsSmile [24]

Answer:

The bigger avocado will be a better deal if the ratio of the sizes of the bigger one to the smaller one is less than the ratio of the prices of the bigger one to the smaller one.

Step-by-step explanation:

Given that two sizea of avocados are being sold, since the regular size is being sold for $0.84 each, let the price for the bigger avocado be $x.

Then note the following:

1. How bigger than the smaller avocado is the bigger one?

This would determine if the price for the bigger one is a bargain, or a mistake.

If for instance, the bigger avocado is double the size of the smaller one, then for any price, $x less that $1.68 (twice of $0.84), it is a bargain.

The bigger avocado will be a better deal if the ratio of the sizes bigger one to the smaller one is less than the ratio of the prices of the bigger one to the smaller one.

6 0
3 years ago
Read 2 more answers
Consider the image of EFGH for the translation (x, y) → (x – 3, y + 1). What is the ordered pair of F′?
omeli [17]

Answer:

F'(-1,3)

Step-by-step explanation:

The rule for the translation is given as

(x,y)\rightarrow (x-3,y+1)

The coordinates of F are (2,2).

We substitute these coordinates into the translation rule to find the coordinates of F'.

F(2,2)\rightarrow F'(2-3,2+1)

F(2,2)\rightarrow F'(-1,3)

3 0
3 years ago
Other questions:
  • Determine whether the two quantities is proportional
    14·1 answer
  • A large on folded flag has an area of 2048 cm^2 and is folded into fourths, and then fourths again, and so on. Record the area o
    9·1 answer
  • How to find the radius of a circle?
    5·1 answer
  • If a polynomial function f(x) has roots 3+ 5 and 6, what
    8·1 answer
  • There are 110 calroies per 177.4 grams of cereal X. find how many calories are in 245.5 grams kf this cereal
    11·1 answer
  • (10 points plus 5 more) Sorry, I forgot to add a picture lol xD Please help out! It will mean alot, thank you!
    12·1 answer
  • What is the slope of the line​
    14·2 answers
  • A circle has a radius of 13 cm what is the diameter of the circle? What is the circumference of the circle? What is the area of
    7·1 answer
  • Please help me!!!!!!!!!
    5·1 answer
  • Look at image………………………
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!