CMPU 102 Lab 2: Using iterative and decision statements Program 1: 1. Log in to your Vassar CS account. 2. Open the cs102 directory you created in the last lab by entering the "change directory" command as follows: cd cs102 3. Change directory into the labs subdirectory by entering cd labs 4. Create a new directory for lab 2 by entering: mkdir lab2 5. Open the directory you created in the last step by entering: cd lab2 6. Write FindSmallest.java Open DrJava and create a class called FindSmallest in a file called FindSmallest.java in the lab2 directory. Create a main method and write the executable code in the main method. a. Prompt for and read three {\bf positive} integers from the key- board. Use the java.util.Scanner class to take in input using the nextInt() method. (Be nice to the user and say please in your prompt.) b. You need to print each number as entered and store the smallest positive integer entered so far in a variable. The initial values of the int entered and the smallest int should initially be set to the MAX_VALUE constant of the Integer class so the values entered by the user must be smaller. c. After the user enters 0, print the smallest number entered to the screen. Your program should work correctly if any number of integers, even some with equal value, are entered. The expected output to the screen from running this class should look like this: Please enter any number of positive integers and I will find the smallest. Enter 0 to stop reading numbers. 4 9 18 22 5 0 The smallest value is 4. or Please enter any number of positive integers and I will find the smallest. Enter 0 to stop reading numbers. 43 75 8 9 7 67 0 The smallest value is 7. Note that the numbers can be entered one per line or all on one line, separated by spaces. Program 2: AssignGrade.java a. Create a class called "AssignGrade.java" in the lab2 directory. This method should b. Prompt for and read a score (a possible real number) from the keyboard using the showInputDialog of the JOptionPane class. c. Use the following scoring policy: score >= 90 A 80 <= score < 90 B 70 <= score < 80 C 60 <= score < 70 D score < 60 F d. Use a series of "if", " if else" and "else" statements to assign a letter grade of type char in each branch. e. Once you have assigned a letter grade, use a switch state- ment to print the letter grade with one of the following comments: Letter grade Comment ------------ ------- 'A' Outstanding work! 'B' Very good work! 'C' Nice work. 'D' Good try. 'F' Happy trails. Expected screen output from running this program: Please enter a score between 0 and 100: 98.5 The grade is A: Outstanding work! Test your program a few times to convince yourself it works. Program III: After you save the AssignGrade program, change the name of the AssignGrade program to AssignGradeCheck.java. Be sure to change the class name of the AssignGradeCheck class too. This program should do what the AssignGrade program did, except for the following added feature: a) Check that the user does actually enter a number between 0.0 and 100.0. After you have read a score, add a while statement that tests the score to see if it is out of range, and, if the score entered is out of range, displays a message prompting for a number between 0.0 and 100.0 and reads the score again. This loop should continue until a number in the correct range is entered. b) The rest of this program should be just like the AssignGrade program. Check with the instructor or a coach for advice on writing this loop. Expected screen output from running this program: Please enter a score between 0 and 100: 998 That score is out of range. Please enter a score between 0 and 100: 79 The grade is C: Good work! Test your program a few times to convince yourself it works. BE SURE TO HAVE A COACH OR YOUR PROFESSOR SEE YOUR WORKING CODE AND HAVE THEM CHECK YOUR NAME OFF ON THE LAB ROSTER AS HAVING COMPLETED THE LAB. IF YOU KEEP THE LAB IN YOUR CS ACCOUNT, YOU CAN ALWAYS PRODUCE IT IF ASKED (AS MIGHT BE THE CASE IF SOMEHOW YOU DID NOT GET CHECKED OFF FOR THE LAB). COMPRESS THE lab2 DIRECTORY AND SUBMIT IT ON THE COURSE MOODLE PAGE.