COP2250 Assignment 2
Due Wednesday, 5/21 at 6 am.
Create a NetBeans project that will implement a number of features.
-
When reading input from the user, always prompt them with an appropriate
message.
-
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.
-
Add comments before each feature. The comments should explain what you did
to implement the feature.
Implement these features in the project.
-
Use a JOptionPane dialog to display a message that contains your name and
a brief description of the assignment.
-
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.
-
Display the first word in upper case letters to the console.
-
Display the second word in lower case letters to the console.
-
Display the last letter of the third word to the console.
-
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'.
-
Read three floats (not doubles) from the console, using a scanner.
-
Indicate which is the largest number.
-
Indicate which is the smallest nubmer.
-
Display the numbers rounded to two decimal places.
-
Generate two random integers from 25 to 36.
-
Use a JOptionPane dialog to display the first divided by the second as a
percentage, to three decimal places.
-
Be sure to calculate the percentage using float division, not integer division.
-
Perform an interest caclulation.
-
Use JOptionPane dialogs to read the numbers.
-
Read a double from the user that is an amount of money to invest.
-
Read a float from the user that represents an interest rate.
-
Read an integer from the user that represents the number of years to invest
the money.
-
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')
-
Display the amount and principal in the local currency.
-
Show the interest as a percentage rounded to two decimal places.
-
Did you remember to echo the input for each feature?
-
Did you remember to provide an appropriate prompt for each input?
-
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.
-
Upload the file as binary.
-
Be sure that the JAR file contains the .java files. Check this page for more
information: Submitting JAR Files