Lab 9 - February 20

 

To receive credit for this lab assignment, you must be finished by Thursday, February 20, at 10:00 p.m.  After this time you will not receive any credit.

 

Instructions:

1.  Login to UNIX, and write a program to do the following:

Write a JAVA program in which you will declare and hard code two double numbers:

double d1 = 4.6;
double d2 = 8.9;
double dResult =0;

You can choose the values that they want to initialize this to.

Then:

-print both numbers d1 and d2

-add the numbers and print the result as follows:
    Adding d1 + d2 = result

-subtract the numbers and print the result as follows:
    Subtracting d1 + d2 = result

-multiply the numbers and print the result as follows:
    Multiplying d1 + d2 = result

-divide the numbers and print the result as follows:
    Dividing d1 + d2 = result


Finally, initialize an integer variable
    int iResult = 0;

and perform the same operations as above but now depositing the result in an int variable.


What happens?
    You must answer this question and send the answer in the body of the e-mail.

 

2.  Send an e-mail in Pine (Getting Started with Pine, PDF) and send the answer to the above question in the e-mail body to the ics111-lab@hawaii.edu account.  Attach your program (.java file) to the e-mail.  Make sure the subject of the e-mail is 'lab 9'.

3.  Check the webpage to make sure that the e-mail arrived.  Here is the URL:

4.  Once I (TA) get the e-mail in my account AND I can verify it on the web, you will receive your lab participation point.

 

Link to the Java API -  to look up any methods of any class you would like to use.