COP2250 Assignment 2

Due Wednesday, 5/21 at 6 am.

Create a NetBeans project that will implement a number of features.

  1. When reading input from the user, always prompt them with an appropriate message.
  2. When displaying output, always display the input that was entered as well as the output that is generated. This is know as echoing the input.
  3. Add comments before each feature. The comments should explain what you did to implement the feature.

Implement these features in the project.

  1. Use a JOptionPane dialog to display a message that contains your name and a brief description of the assignment.
  2. Use the scanner to read a complete line from the console. Be sure to enter a line that has at least four words in it, each word should be separated from the next by one space. Do not read the words one at a time, read them all at once, in one call to the scanner.
    1. Display the first word in upper case letters to the console.
    2. Display the second word in lower case letters to the console.
    3. Display the last letter of the third word to the console.
    4. For the fourth word, display it with the first letter last to the console. For example, if the word is 'fourth', it would be displayed as 'ourthf'.
  3. Read three floats (not doubles) from the console, using a scanner.
    1. Indicate which is the largest number.
    2. Indicate which is the smallest nubmer.
    3. Display the numbers rounded to two decimal places.
  4. Generate two random integers from 25 to 36.
    1. Use a JOptionPane dialog to display the first divided by the second as a percentage, to three decimal places.
    2. Be sure to calculate the percentage using float division, not integer division.
  5. Perform an interest caclulation.
    1. Use JOptionPane dialogs to read the numbers.
    2. Read a double from the user that is an amount of money to invest.
    3. Read a float from the user that represents an interest rate.
    4. Read an integer from the user that represents the number of years to invest the money.
    5. Use a JOptionPane dialog to display the amount of money that will be on hand if the principal is invested for those many years at that interset rate. Use the formula principal*(1 + interest)**years. (** means 'raise to the power')
    6. Display the amount and principal in the local currency.
    7. Show the interest as a percentage rounded to two decimal places.
  6. Did you remember to echo the input for each feature?
  7. Did you remember to provide an appropriate prompt for each input?
  8. Did you remember to add a comment before each feature that explains what you are doing?

Submit Homework

To hand in the assignment, upload the JAR file online: Submitting homework on-line via the Web.