You are on page 1of 2

COSC1046 Chapter 2 - Elementary Programming

Q1 - Programming (3 marks)

● Write a program that accepts the investment amount (double), monthly interest rate
(double), and number of years (int) from the user. The program will then display the
future value of the investment using the following formula:
𝑦𝑒𝑎𝑟𝑠
○ 𝑓𝑢𝑡𝑢𝑟𝑒𝑉𝑎𝑙𝑢𝑒 = 𝑖𝑛𝑣𝑒𝑠𝑡𝑚𝑒𝑛𝑡𝐴𝑚𝑜𝑢𝑛𝑡 × ( 1 + 𝑚𝑜𝑛𝑡ℎ𝑙𝑦𝐼𝑛𝑡𝑒𝑟𝑒𝑠𝑡𝑅𝑎𝑡𝑒)
● Follow the formatting from the output screenshot. It is not necessary to round the final value.

Output:

Q2 - Programming (4 marks)

● Use a Scanner to accept 2 integers from the user, then display all of the results from:
○ Adding the values together
○ Subtracting the second value from the first value
○ Multiplying the values together
○ Dividing the first value by the second value
● Repeat all of the operations again using double variables instead of integers
Output:
Q3 - Discussion (3 marks)

● List the numeric data types in Java ordered from least to greatest number of bits.
Please specify how many bits each data type requires.

Please submit a PDF file containing all source code and discussion answers (see
example/template file on the LMS)

You might also like