ICS 111, Introduction to Computer Science
Lab 7 - Equations in Java - September 25
To receive credit for this lab assignment, you must be finished by
Thursday, September 25, at 11:59 p.m. After this time you will not receive any credit.Instructions:
1. Login to UNIX
2. Create and edit a Java program called 'LabX.java' (substitute the lab
number for X- where is the number of the lab- such as 'Lab1.java') in Pico
to do the following:
- Compute the circumference AND the area of a circle. You will need to prompt the user for the radius of the circle. The emphasis will be in following the JAVA coding standard and formatting a nice output that will tell the user exactly what is going on.
Formulas: (the 'x' means 'times' as in multiplication, and radius squared means r2or r^2)
circumference = pi x diameter (where diameter equals 2 times the radius)
area = pi x r2 (radius-squared)Note: You can hard code the value for Pi as 3.14, OR you can use Java's value for Pi- this can be looked up in the Math class in the Java API
Note: After prompting the user for the radius, you will first need to read the input String, and then parse that String to pull out the number
- Before you submit your code, make sure that your code follows the rules of the Java Coding Standard. Visit this link to look up Java code formatting rules and be sure that your program adheres to these guidelines.
3. Compile and run the program. Be sure to thoroughly test the program after getting it compiled and running to make sure it meets ALL of the requirements above.
4. Get into Pine, and attach the file to an e-mail
5. Send the e-mail / file(s) to the ics111-lab@hawaii.edu account.
6. Check the webpage to make sure that the e-mail arrived. Note that this will be sent to the ICS 111 lab address (ics111-lab@hawaii.edu). This one is different from the ics111-homework@hawaii.edu. There are two different ones so we can have homework assignments and lab assignments separate.
Here is the URL:
http://www2.hawaii.edu/~tp_200/bmf/ics111-lab.html
7. Once I (TA) get the e-mail in my account AND I can verify it on the web, your lab assignment will be graded. For grading policies on your lab, click here...
Link to the Java API - to look up any methods of any class you would like to use.
Link to the Java Coding Standard - to look up Java code formatting rules.