Question: use java create following program: In this assignment, you will add input checking in the program in assignment 2. A valid student ID should be
use java create following program:


In this assignment, you will add input checking in the program in assignment 2. A valid student ID should be an integer between 1000000 and 9999999. A valid student GPA should be a double between 0 and 4.0. No other function is added to the program in assignment 2. 1. The program will first ask the user to input the number of students to be created. If the user inputs a value in wrong format, such as a double or string, the program should print an error message Please input a number between 1 and 10. The number should be from 1 to 10. Otherwise, the program prints I cannot create xxx students! where xxx is the input number. If the input is in wrong format or outside the range, the program should ignore the input and prompt again. 2. When the program prompts the user for student ID, if the user input a value in wrong format or an invalid value, it will print an error message Please input an integer between 1000000 and 9999999., ignore the input, and prompt again. 3. When the program prompts the user for student GPA, if the user input a value in wrong format or an invalid value, it will print an error message Please input a valid GPA (0-4.0), ignore the input, and prompt again. 4. After the input of the Student objects, the program will then search the student array. It keeps asking the user for a student ID. If the user inputs 0, the program will print Goodbye! and exit. If the user does not input an integer, the program should print an error message, Please input an integer between 1000000 and 9999999. If the user inputs an integer but an invalid ID, the program will a message, A valid ID is an integer between 1000000 and 9999999. In both cases, the program will ignore the input and prompt the user again. 5. If the user inputs a valid ID, the program will search the student array for the given student ID. If a match is found, the program will call printStudent() to print the student information. If no match is found, the program prints "Student ID xxxx not found. where xxxx is the ID given by the user. 6. Since the student array may not be sorted, you should use linear search. 7. A sample run will look like this where the green texts are user inputs: How many students do you have(1-10): two Please input a number between 1 and 10. How many students do you have(1-10): 0 I cannot create students! How many students do you have(1-10): 11 I cannot create 11 students! How many students do you have(1-10): 2 Student 1 name: Si Ti Student 1 ID:oneone Please input an integer between 1000000 and 9999999 Student 1 ID:2021 Please input an integer between 1000000 and 9999999 Student 1 ID:999999 Please input an integer between 1000000 and 9999999 Student 1 ID:10000000 Please input an integer between 1000000 and 9999999 Student 1 ID:1000000 Student 1 GPA: good Please input a valid GPA (0-4.0) Student 1 GPA: 4.11 Please input a valid GPA (0-4.0) Student 1 GPA:-0.0000001 Please input a valid GPA (0-4.0) Student 1 GPA:2 Student 2 name: Sa Li Student 2 ID:9999999 Student 2 GPA:4 Enter a valid student ID (enter o to quit): not sure Please input an integer between 1000000 and 9999999 Enter a valid student ID (enter o to quit): 1000 A valid ID is an integer between 1000000 and 9999999 Enter a valid student ID (enter o to quit): 1000000 Student name:Si Ti Student ID:1000000 Student GPA:2.0 Enter a valid student ID (enter o to quit): 9999999 Student name:Sa Li Student ID:9999999 Student GPA:4.0 Enter a valid student ID (enter o to quit): 0 Goodbye
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
