Difference between revisions of "CISC181 S2017 Lab1"
From class_wiki
(Created page with "* [http://developer.android.com/sdk/index.html Download Android Studio] and install it on your machine ** [http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloa...") |
|||
Line 1: | Line 1: | ||
* [http://developer.android.com/sdk/index.html Download Android Studio] and install it on your machine | * [http://developer.android.com/sdk/index.html Download Android Studio] and install it on your machine | ||
+ | <!-- | ||
** [http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html Java JDK 7] is a system requirement | ** [http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html Java JDK 7] is a system requirement | ||
** JRE is a system requirement on Mac OS X. However, [http://support.apple.com/kb/DL1572?viewlocale=en_US&locale=en_US this] worked where JRE alone didn't | ** JRE is a system requirement on Mac OS X. However, [http://support.apple.com/kb/DL1572?viewlocale=en_US&locale=en_US this] worked where JRE alone didn't | ||
+ | --> | ||
* Either on your machine or on an eCalc machine in lab: | * Either on your machine or on an eCalc machine in lab: | ||
** Make a new project following [[CISC181_S2015_NewAndroidStudioProject | these ]] instructions | ** Make a new project following [[CISC181_S2015_NewAndroidStudioProject | these ]] instructions |
Revision as of 11:05, 13 February 2017
- Download Android Studio and install it on your machine
- Either on your machine or on an eCalc machine in lab:
- Make a new project following these instructions
- If you haven't already, paste the following into MyClass: public static void main(String[] args) { System.out.println("Hello, world!"); }
- Confirm that you can build and run it (by pressing the green triangle button or choosing "Run" from the Run menu)
- Modify MyClass.java as follows:
- Add your name and section number as a multi-line comment
- Using a single-line comment, disable the "Hello, world" print statement in main()
- You will use main() to compute several geometric identities involving a general triangle with sidelengths a, b, and c as shown below. Declare these variables as double, prompt the user to enter them, and read each in using the Scanner class.
- Heron's Formula gives a method to compute the area A of the triangle. Follow the link and use the first formula to derive the semi-perimeter s and A from a, b, and c; implement it using Java math expressions and/or functions; and report both s and A with System.out.println().
- The Law of Cosines can be used to calculate the angle γ (gamma) between a and b (second formula in Applications section of link). Math.acos() will give the angle in radians; please convert it to degrees and report it with System.out.println()
- You might notice a lot of decimal places printed in your answers. Change your println() to format as necessary to only print 2 digits after the decimal for s, A, and γ.
- Use proper naming and formatting style throughout your code.
Submit your MyClass.java on Sakai by Friday, February 17