(Solved Homework): NEEDS TO BE IN JASMIN so a .j file NOT a .java file…

NEEDS TO BE IN JASMIN so a .j file NOT a .java file

The following jasmin code estimates e using the series:

Don't use plagiarized sources. Get Your Custom Essay on
(Solved Homework): NEEDS TO BE IN JASMIN so a .j file NOT a .java file…
Get an essay WRITTEN FOR YOU, Plagiarism free, and by an EXPERT!
Order Essay

0! 1! 2! 3!

Modify this code to estimate pi using the series:


The series for e converges very quickly, so the following code only goes for 20 iterations. The series for pidoes not converge quickly. Calculate to at least 100,000 terms once you know your code is working. The following code prints at each iteration of the loop. You probably don’t want to do that for 100000 terms! Take the print out of the loop and move it to after the loop.

; — Copyright Jonathan Meyer 1996. All rights reserved. —————–
; File:      jasmin/examples/Count.j
; Author:    Jonathan Meyer, 10 July 1996
; Purpose:   Counts from 0 to 9, printing out the value
; ————————————————————————-

.class public Eest
.super java/lang/Object

; standard initializer
.method public <init>()V
invokenonvirtual java/lang/Object/<init>()V
.end method

.method public static main([Ljava/lang/String;)V
; set limits used by this method
.limit locals 16
.limit stack 8

; setup local variables:

;    1 – the PrintStream object held in java.lang.System.out
getstatic java/lang/System/out Ljava/io/PrintStream;

;    2 – the counter used in the loop
bipush 20   ; loop counter in 2
dstore 4   ; e sum in 4
dstore 6   ; f.p. factorial in 6
dstore 8   ; f.p. n in 8

; now loop 10 times printing out a number


; compute 10 – <local variable 2> …
dload 8
dadd       ; increment n
dstore 8   ; store n
dload 6
dstore 6   ; store n!
dload 6    ; load n!
dload 4
dstore 4
invokestatic java/lang/String/valueOf(D)Ljava/lang/String;
; … and print it
aload_1    ; push the PrintStream object
aload_3    ; push the string we just created – then …
invokevirtual java/io/PrintStream/println(Ljava/lang/String;)V

; decrement the counter and loop
iinc 2 -1
ifne Loop

; done

.end method

Show transcribed image text0! 1! 2! 3!

Expert Answer


Java Code:

//Define a class Eest

public class Eest


//Define main

public static void main(String[]args)


//Compute value

double val=compute_Pi(100000);

//Display value



//Define a method

public static double compute_Pi(int count)


//Declare variable

double val=1;


for(int i=3;i<count;i+=4)


//Compute value




return val * 4;



Modified bytecode:

Compiled from “Eest.java”

public class Eest {

public Eest();


0: aload_0

1: invokespecial #1                  // Method java/lang/Object.”<init>”:


4: return

public static void main(java.lang.String[]);


0: ldc           #2                  // int 100000

2: invokestatic #3                  // Method compute_Pi:(I)D

5: dstore_1

6: getstatic     #4                  // Field java/lang/System.out:Ljava/


9: dload_1

10: invokevirtual #5                  // Method java/io/PrintStream.printl


13: return

public static double compute_Pi(int);


0: dconst_1

1: dstore_1

2: iconst_3

3: istore_3

4: iload_3

5: iload_0

6: if_icmpge     29

9: dload_1

10: dconst_1

11: iload_3

12: i2d

13: ddiv

14: dsub

15: dconst_1

16: iload_3

17: iconst_2

18: iadd

19: i2d

20: ddiv

21: dadd

22: dstore_1

23: iinc          3, 4

26: goto          4

29: dload_1

30: ldc2_w        #6                  // double 4.0d

33: dmul

34: dreturn


Homework Ocean
Calculate your paper price
Pages (550 words)
Approximate price: -

Why Work with Us

Top Quality and Well-Researched Papers

We always make sure that writers follow all your instructions precisely. You can choose your academic level: high school, college/university or professional, and we will assign a writer who has a respective degree.

Professional and Experienced Academic Writers

We have a team of professional writers with experience in academic and business writing. Many are native speakers and able to perform any task for which you need help.

Free Unlimited Revisions

If you think we missed something, send your order for a free revision. You have 10 days to submit the order for review after you have received the final document. You can do this yourself after logging into your personal account or by contacting our support.

Prompt Delivery and 100% Money-Back-Guarantee

All papers are always delivered on time. In case we need more time to master your paper, we may contact you regarding the deadline extension. In case you cannot provide us with more time, a 100% refund is guaranteed.

Original & Confidential

We use several writing tools checks to ensure that all documents you receive are free from plagiarism. Our editors carefully review all quotations in the text. We also promise maximum confidentiality in all of our services.

24/7 Customer Support

Our support agents are available 24 hours a day 7 days a week and committed to providing you with the best customer experience. Get in touch whenever you need any assistance.

Try it now!

Calculate the price of your order

Total price:

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

Our Services

No need to work on your paper at night. Sleep tight, we will cover your back. We offer all kinds of writing services.


Essay Writing Service

No matter what kind of academic paper you need and how urgent you need it, you are welcome to choose your academic level and the type of your paper at an affordable price. We take care of all your paper needs and give a 24/7 customer care support system.


Admission Essays & Business Writing Help

An admission essay is an essay or other written statement by a candidate, often a potential student enrolling in a college, university, or graduate school. You can be rest assurred that through our service we will write the best admission essay for you.


Editing Support

Our academic writers and editors make the necessary changes to your paper so that it is polished. We also format your document by correctly quoting the sources and creating reference lists in the formats APA, Harvard, MLA, Chicago / Turabian.


Revision Support

If you think your paper could be improved, you can request a review. In this case, your paper will be checked by the writer or assigned to an editor. You can use this option as many times as you see fit. This is free because we want you to be completely satisfied with the service offered.

× Contact Live Agents