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
3.5.6 Introduce Yourself, Part 2<br><br><br> please hellllpp it keeps saying the code is wrong
dalvyx [7]

Answer:

In Python:

name = "Arthur"

age = "62"

print("Hi! My name is "+name+" and I am "+age+" years old")

Explanation:

Given

See attachment

Required

Write a code to introduce yourself

Initialize name

name = "Arthur"

Initialize age

age = "62"

Print introduction

print("Hi! My name is "+name+" and I am "+age+" years old")

3 0
3 years ago
Add the following binary numbers. 101110010 and 111001101
bonufazy [111]

Answer:

101110010 is 370 in decimal (base 10, what we usually do math in) and 111001101 is 461 in decimal. The sum of 370 and 461 is 831, and 831 is binary is 1100111111. So, if you want the answer in decimal it is \boxed{831_{10}} and if you want the answer in binary, it is \boxed{1100111111_2}.

4 0
3 years ago
What two internetworking devices does xyz schools have to install?
patriot [66]
PC's and LAN spreaders* or internet network extenders.
*if the school uses a LAN network.
7 0
4 years ago
1. Ce este o baza de date? (1p)
lesya [120]

Answer:

would you mind telling me what this says im still learning my spanish

Explanation:

6 0
3 years ago
Read 2 more answers
Considering the tables
MrRa [10]

Answer:

a) SELECT COUNT(*)

FROM Supplies

WHERE sid=T OR sid=X;

b) SELECT sid

CASE

WHEN sid=IMB AND pid=T

THEN 'YES'

ELSE 'No'

END AS 'check'

FROM Supplies

c) SELECT pid

WHERE partname != computers

FROM Parts

LEFT JOIN Supplies

ON Parts.pid=Supplies.pid;

d) SELECT color

FROM Parts

WHERE pid=T;

Explanation:

a) Here we will use aggregate function along with WHERE and operators to count for specifc part ids

b) This is a CASE query

c) This is again a case query but invloves two separate tables. So, here 1st required values from 1st table are selected and then table is joined with the other table using OUTER JOIN

d) This is again a CASE query. It can be written by calling upon the all the values in one column corresponding to values in another column

6 0
3 years ago
Other questions:
  • Changes in computer technology have an effect on _____. computer scientists only people who work with computers only everybody p
    12·2 answers
  • For example, one might start with a population of 500 organisms, a growth rate of 2, and a growth period to achieve this rate of
    6·1 answer
  • You suspect that an attacker has hidden files on your machine. What Linux command would you use to search for files with a file
    14·1 answer
  • Identify three different meanings of the word "interface" in Java Programing language.
    6·1 answer
  • Ifdjgidfpojcjdizchnllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllllsssssssssssssssssssssssssss
    13·2 answers
  • int FindFirstCharFrom(char* str, char *sought); The function FindFirstCharFrom takes pointers to two C strings as arguments, str
    13·1 answer
  • Which of the following identifies the most appropriate courses to take in high school for someone interested in becoming a mecha
    9·1 answer
  • Why would you browse by entering a URL rather than use a link in a Web page
    15·1 answer
  • What is wrong with line 3 ?
    11·1 answer
  • A social service agency hires accenture to improve training and experiences for caseworkers. What is one way accenture can use v
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!