`long`

, `double`

, and `Math.pow`

Due Tuesday, September 13 at 11:59 PM

By the time you have completed this work, you should be able to:

- Be able to identify the type of expressions involving
`int`

,`String`

,`long`

, and`double`

- Read in user input as big numbers (
`long`

) or floating-point numbers (`double`

) - Write computations which intermix
`int`

,`long`

, and`double`

- Use
`Math.pow()`

for exponentiation

`lab3questions.txt`

`LongPerimeterCalculation.java`

`DegreeConversion.java`

`CompoundInterest.java`

`collaborators.txt`

Download the `lab3questions.txt`

file, and edit it with a text editor of your choice.
Answer the questions in the file.
Be sure to use the appropriate formatting.
Save your work in your own local copy of `lab3questions.txt`

.
Be sure to **preserve the filename and file type!**

`LongPerimeterCalculation.java`

Download the `LongPerimeterCalculation.java`

file, and open it in jGrasp (or a text editor of your choice).
The program you write should behave *exactly* the same as `PerimeterCalculation.java`

from last week.
The only difference is that instead of using `int`

variables to store the width, height, and area, you should use `long`

variables.
Similarly, you should use `nextLong()`

as opposed to `nextInt()`

.
An example run of the program is shown below, with user input in **bold**:

Enter width:2000000000Enter height:2000000000Perimeter: 8000000000

For full credit, the output of your program must match **EXACTLY** to the output shown above.
Note that if you use `int`

variables instead, your calculations will be incorrect, resulting in a different area shown above.
As a hint, you may want to simply copy your code from your `PerimeterCalculation.java`

solution, and then modify it to use `long`

variables and `nextLong()`

.
Your code will overall look somewhat similar to `LongAddTwo.java`

`DegreeConversion.java`

Download the `DegreeConversion.java`

file, and open it in jGrasp (or a text editor of your choice).
The program you need to write will take a temperature in Celsius and convert it to Fahrenheit.
Notably, the temperature received can be a floating-point value, and the result will be a floating-point value, so you will need to use `double`

variables and `nextDouble()`

.

You can convert a temperature in Celsius to a temperature in Fahrenheit using the following formula, where `C`

represents the input temperature in Celsius, and `F`

represents the output temperature in Fahrenheit:

F = C * 1.8 + 32

An example run of the program is shown below, with user input in **bold**:

Enter temperature in Celsius:41.75Fahrenheit: 107.15

For full credit, the output of your program must match **EXACTLY** to the output shown above.
Note that if you use `int`

variables instead, your calculations will be incorrect, resulting in a different Fahrenheit temperature shown above.

`CompoundInterest.java`

Download the `CompoundInterest.java`

file, and open it in jGrasp (or a text editor of your choice).
The program you need to write will compute compound interest including principal.
In order to perform this computation, your program will need to gather the following inputs from the user in the following order:

- Principle (
`P`

, a`long`

value) - Annual interest rate (
`R`

, a`double`

value) - Number of times interest is compounded per year (
`N`

, an`int`

value) - Number of years invested (
`T`

, an`int`

value)

With the above information, the compound interest can be computed using the following formula, where `A`

represents the result (the compound interest including principle):

A = P * (1 + R / N)^{(N * T)}

Note that the result (`A`

) can be a floating-point value, so it should be represented as a `double`

if it has its own variable.
Exponentiation can be performed with `Math.pow`

; for example, `5`

can be written in Java like so:
^{4}

Math.pow(5, 4)

An example of exponentiation in practice can be seen in `Exponentiation.java`

.

An example run of the program you must write is shown below, with user input in **bold**:

Enter principle (long):500Enter annual interest rate (double):0.053Enter number of times interest is compounded per year (int):12Enter number of years invested (int):8Compound interest including principal:763.3178417090967

For full credit, the output of your program must match **EXACTLY** to the output shown above.
If you do not use the correct variable types, your calculation will likely be incorrect and lead to output which is different from what is shown above.

Log into Canvas, and go to the COMP 110 class. Click “Assignments” on the left pane, then click “Lab 3”. From here, you can upload your answers and your code. Specifically, you must turn in the following three files:

`lab3questions.txt`

`LongPerimeterCalculation.java`

`DegreeConversion.java`

`CompoundInterest.java`

In addition, if you collaborated with anyone else, be sure to download `collaborators.txt`

and write the names of the people you collaborated with in the file, one per line.
Please submit this file along with the other four files.

You can turn in the assignment multiple times, but only the last version you submitted will be graded.