Main topics: User input
Basic String Methods
Boolean Expressions
if & if - else Statements
Program Specification:
Write a Java program that does the following:
Prompts the user to input exactly three characters, which constitude a valid Double literal in Java.
Gets whatever the user enters and stores it into a String variable, using the the Scanner's .nextLine() method.
Determines if the input string is indeed a valid Double literal of length three.
Displays this determination to the user in a reasonable report format.
Grading:
Performance Indicator [1] [2] [3]
Readability and documentation1 2 2
Use of conditional operators 1 2 2
Functional requirements 2 3 4
Efficiency 1 2 2
Sample run(s):
Please enter a valid (3 character) double literal : 123
123 is a valid (3 character) double literal
Please enter a valid (3 character) double literal : 002
002 is a valid (3 character) double literal
Please enter a valid (3 character) double literal : +45
+45 is a valid (3 character) double literal
Please enter a valid (3 character) double literal : -45
-45 is a valid (3 character) double literal
Please enter a valid (3 character) double literal : 4.5
4.5 is a valid (3 character) double literal
Please enter a valid (3 character) double literal : 0.1
0.1 is a valid (3 character) double literal
Please enter a valid (3 character) double literal : 45.
45. is a valid (3 character) double literal
Please enter a valid (3 character) double literal : +.1
+.1 is a valid (3 character) double literal
Please enter a valid (3 character) double literal : -.1
-.1 is a valid (3 character) double literal