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
elena-s [515]
3 years ago
15

Given two Strings String s1 = "11223351638791377189728193"; String s2 = "983763978669976862724569282405742578"; and String varia

ble s3. Write a piece of code so that s3 refers to a String whose integer value will be the product of integer values of s1 and s2. Java.
Computers and Technology
1 answer:
inn [45]3 years ago
7 0

Answer:

import java.math.BigInteger;  

public class Main {  

public static void main(String[] args)  {  

String s1 = "11223351638791377189728193";   String s2 = "983763978669976862724569282405742578";

BigInteger num1 = new BigInteger(s1);  

BigInteger num2 = new BigInteger(s2);  

BigInteger product = num1.multiply(num2);  

String s3 = product.toString(10);

System.out.println(s3);  

}  

}  

Explanation:

Because s1 and s2 contain large integers, the program need the biginteger module in other to compute the products of s1 and s2 when converted to integers.

This line initializes the two string variables s1 and s2

String s1 = "11223351638791377189728193";   String s2 = "983763978669976862724569282405742578";

The next two lines convert the two strings to BigInteger. This allows the program to multiply large integers

<em> BigInteger a = new BigInteger(s1);   </em>

<em>BigInteger b = new BigInteger(s2);  </em>

<em />

This computes the product of the two big integers

BigInteger product = num1.multiply(num2);  

This converts the product to String s3

String s3 = product.toString(10);

This prints s3

System.out.println(s3);  

}  

}  

You might be interested in
Can web sites contain copyright material? <br> Yes <br> No
Maru [420]
Yes they can contain copyright
6 0
3 years ago
Read 2 more answers
Guys Do you know about e-waste recycling well ?
TEA [102]
<span>E-waste is a popular name for elecronics at the end of their "useful life".. computers, tv, steros, copiers, and fax mations are some common products. many of them can be reused, refurbished, or recycled. 
</span>
4 0
3 years ago
Read 2 more answers
100 POINTS NEED ASAP PLEASE HELP
givi [52]

It is actually podcast! i took the quiz as well :)

3 0
3 years ago
Read 2 more answers
Mobile devices need to work within limited screen space .
zloy xaker [14]
True. Mobile devices need to work within limited screen space. Mobile devices are designed to be portable and designed to be carried around without hassle. Mobile devices are used for personal activities such as talking privately, chatting and many more that is why it is designed to be small.
3 0
3 years ago
What is the purpose of a mail merge field?
Alex73 [517]

Answer:

to set up placeholders in a document where data will be inserted

4 0
3 years ago
Read 2 more answers
Other questions:
  • How do you ask someone for help?
    6·1 answer
  • How to revert a dismissed javascript popup alert box in chrome?
    5·1 answer
  • The series of events that make up a story is called
    6·2 answers
  • With a web app, much of the program code for the software runs locally on a computer, instead of running on a remote computer co
    13·1 answer
  • Jeremy Aronoff has purchased a new laptop. He wants to customize the operating system to meet his
    7·1 answer
  • What tool can help discover and report computer errors when you first turn on a computer and before the operating system is laun
    9·2 answers
  • What dog breed is this
    6·1 answer
  • Which of the following is NOT one of the three main ways to control a program when writing code?
    6·2 answers
  • 1. The supervisory software of a computer is called _____ (a) operating system (b) high – level language (c) transistor
    5·1 answer
  • By the mid-1990s, how did revenue generated from video games compare to revenue generated from movies?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!