Triton College Java Program Calculating N Question

1. In th
e class, I had shown you with a Java program calculating n! when n = 50 (or = 200 etc.) can

have very different results when data type is int, long, float, or double.

In the class, you also noted that the calculated answer for double precision through calculator is
different from that through Java in the last digit (I don’t remember which n! since I forgot to save
the output).
Below are the results for 50! when calculated using 4 different tools / means:MATLAB 3.
041409320171338e+64Calculator 3.0414093201713378043612608166065e+64
Java 3.0414093201713376E64
Excel 3.04141E+64
Write
some observations of your ten n! calculated with 4 different tools when comparing these results. For example, for 50!, we can say that the results for all 4 tools agree with 4 digits after
decimal point (the Excel result in the 5
th digit differs, but agrees in the so called significance), and the first 3 tools MATLAB, calculator, and Java agree up to 14 digits after decimal point.

2.
) Convert my smallfact.java to at least one other computer language that your group
is familiar with such as C / C# / C++ / Python / Javascript, etc. Show the results of 50!. Do
you have the same precision like 16 digits of precision, or you have more, or you have less
with another computer language? Do you have magnitude E64, or higher, or lower? What
data type did you use in this programming language: short, int, long, float, double, or
anything else?

3. Enhance your program of question 3, so that it can run in several data types: int, long, float, and double.
Use your program to run 20!, 30!, 40!, 50!, and 80! And tabulate them.

4.
Generalize Nyhoff’s Figure 2_1 to use different programming languagesThere is Nyhoff’s Figure2_1, a C file that computes 2, 20, 200, 2000, etc. until it overflows (this
will be demoed on 8/31/21 Tuesday briefly)
(a)
(15%+*) Covert Nyhoffs Figure 2_1 code to C#, Java, Visual Basic and show the outputs. You can earn up to 12% for this question for conversion to two different computer
programming language. Do you see any overflow for this different code (also does
overflow happen at different index I for different computer languages?)
(b)
(15%+*) Repeat part (d) for the computer languages Python and Javascript.(Python and
Javascript are generally known as computer languages without strong data type). What do
you observe?

Figure 2.1 Overflow Demonstration–Version 1
//– Program to demonstrate the effects of overflow
#include
using namespace std;
int main()
{
int number – 2;
for (int i = 1; i

Calculate your order
275 words
Total price: $0.00

Top-quality papers guaranteed

54

100% original papers

We sell only unique pieces of writing completed according to your demands.

54

Confidential service

We use security encryption to keep your personal data protected.

54

Money-back guarantee

We can give your money back if something goes wrong with your order.

Enjoy the free features we offer to everyone

  1. Title page

    Get a free title page formatted according to the specifics of your particular style.

  2. Custom formatting

    Request us to use APA, MLA, Harvard, Chicago, or any other style for your essay.

  3. Bibliography page

    Don’t pay extra for a list of references that perfectly fits your academic needs.

  4. 24/7 support assistance

    Ask us a question anytime you need to—we don’t charge extra for supporting you!

Calculate how much your essay costs

Type of paper
Academic level
Deadline
550 words

How to place an order

  • Choose the number of pages, your academic level, and deadline
  • Push the orange button
  • Give instructions for your paper
  • Pay with PayPal or a credit card
  • Track the progress of your order
  • Approve and enjoy your custom paper

Ask experts to write you a cheap essay of excellent quality

Place an order