Use what you have learned about theScanner class, Constants, variables,print(ln),Strings, Decisions,Loops,Methods,andArraysto complete the project. **Please note: We will usingArrays only for this...


Use what you have learned about theScanner class, Constants, variables,print(ln),Strings, Decisions,Loops,Methods,andArraysto complete the project. **Please note: We will usingArraysonlyfor this project. We will useArrayListsin Project 4.**


Remember to watch theLecture Videosand additional videos in iCollege for examples on these topics and how tocommentyour program correctly. **Please do not use anyadvancedmaterial that is not in Chapters 1 - 6.


We will be completing our Programming Projects usingCode Check. Nothing is required by you to use this program. For each project, I will provide a URL that will take you to the project to complete. Once you have completed the coding project (you have unlimited attempts), you willdownload theReportfrom the Code Check website anduploadthis zipped file(s) to this Assignment folder. Inside this zipped file will be your completed code and your calculated score based on testing. I will view each of these and make adjustments and feedback as necessary. Iencourage you touse your IDE (jGrasp/Eclipse) to write the codeand thencopy and pasteover to Code Check so you will gain experience using an IDE.


Description of Project 3 Purpose:


In Project 3, we will re-imagine our StudentScores.java program from Project 2. We are going to learn how to useMethodsto make our code more effective and handle "separation of concerns" andArraysto store data.Think ofmethodslike functions - each method handlesone specificproblem or task, but is able to be called/reused as many times as needed. Think of anArrayas a "list" of items of a given type.


In this project, our Array or "lists", will contain student names as typeStringand student scores as typedouble.We will ask the user how many names and scores they wish to enter and use this value infor loopsto add names and score to our two Arrays. We will createmethodsto fill our arrays with the names and scores.Once all the names and scores have been added to our Arrays (or "lists), we will write methods toget the indexof the highest score, andprint the highest studentname and score (much like Project 2).


The following are sample runs of the program to help you write your code and format your output:


Sample Output 1:

Enter the number of students:5 Please enter a student:AmandaPlease enter a student:JohnPlease enter a student:David Please enter a student:AmalPlease enter a student:JacquiPlease enter a score:84.5Please enter a score:72.3Please enter a score:66 Please enter a score:98.5Please enter a score:90.7Top studentAmal's score is 98.5



Sample Output 2:

Enter the number of students:-4Invalid. Please renter number of students >>2 Please enter a student:NarobiPlease enter a student:WilsonPlease enter a score:90.2Please enter a score:-25 Invalid. Enter a score >>87.4Top studentNarobi's score is90.2


Sample Output 3:

Enter the number of students: 3Please enter a student: RalphPlease enter a student: DanieliaPlease enter a student: AmirPlease enter a score: 65.4Please enter a score:105Invalid. Enter a score >>100 Please enter a score: 98.9Top studentDanielia's score is 100.0


Instructions Project 3:



  1. PLEASE MAKE SURE YOU READ THE "Java Coding Best Practices" DOCUMENT IN THE GRADED ASSIGNMENTS. YOU WILL NOW HAVE TO COMMENT YOUR METHODS.

  2. Go to the following URL to complete the project:
    Project 4

  3. Using an IDE (jGrasp or Eclipse), create a new class file namedStudentScores2.java**You may wish to start in your IDE with all of thegivencode on the Code Check project site.

  4. You will be filling in code everywhere you see the ellipses (. . .) in the code. Please follow the instructions and use the Sample Outputs to guide you.

  5. Write the Classcommentand@authorand@versiontags

    • NOTE: When writing a Java Class withmethods, it is usually best to write the methods first and then go back and complete the main method. We will be doing this for this project, so in Step 5 you will start writing the first method and continue from there. Methods are writtenoutsideof themainmethod, so make sure you set up a "blank" (for now) main method with { and } and then start writing methods.



  6. Write agetStudents(int num)method:

    1. Write the method comment and @tagabovethe method header (not inside)

    2. Create a new Scanner to read the input.

    3. Create a new array of typeStringto hold the student names with the size being the parameter value sent into the method.

    4. Write a for loop that prompts for the student name and reads the names into the array.

    5. Returnthe array of student names. **Note: Make sure thereturnstatement is thelaststatement in your method - right before the closing}



  7. Write agetScores(int num)method:

    1. Complete the method comment and @tagsabovethe method header (not inside)

    2. Create a new Scanner to read the input.

    3. Create a new array of typedoubleto hold the student scores with the size being the parameter value sent into the method.

    4. Write a for loop that prompts for the student score and reads the scores into the array.


      • *Use awhile loopto validate that the score entered is between 0 and 100 (you can use the Java OR || in your test).

      • If it is invalid, prompt the user for a new score (see Sample Output) and read the new score into the array.



    5. Returnthe array of student scores.**Note: Make sure thereturnstatement is thelaststatement in your method - right before the closing}



  8. Write agetHighestIndex(double[] scores)method that takes in the array of student scores as a parameter and returns anintvalue for the index of the highest score.


    1. Complete the method comment and @tagsabovethe method header (not inside)

    2. Declare an initialize a variable for the highest index

    3. Declare and initialize a variable for the highest score (the easiest way to do this is to initialize it to the first value in the array).

    4. Use afor loopthat starts at 1 (bc we already used index 0 in #3) and goes up to the length of the array.

      • Use anif statementto test if the current score is higher than your "highest" score variable.

      • If it is, set the index variable to the current index value (i) and the highest score to the current value



    5. Returnthe index of the highest score.**Note: Make sure thereturnstatement is thelaststatement in your method - right before the closing}


  9. Write aprintHighestStudent()method that takes in asparameters, the array of names, the array of scores, and the index of the highest score. **NOTE: You must write theentiremethod header with parameters for this method - the whole method! Use the previous methods as a guide.

    1. Complete the method comment and @tagabovethe method header (not inside)

    2. Add a statement to print a blank line (to match the sample output).

    3. Use println statements to output the Top Student's name and score using the arrays and the index sent in as parameters.



  10. NOW - go back to themain method:

    1. Create a new Scanner object to read in the number of students.

    2. Prompt the user for the number of students and read into a variable.

      • Use awhile loopto validate that the input is at least 1

      • If not, prompt the user to enter a value again and read into the variable (see Sample Output)



    3. Create aStringarray to hold the student names andinitializeit by calling thegetStudents(parameter HERE)method and storing the return in your array variable. *Remember to send the variable for number of students as aparameterto the method.

    4. Create adoublearray to hold the student scores andinitializeit by calling thegetScores(parameter HERE)method and storing the return in your array variable.*Remember to send the variable for number of students as aparameterto the method.

    5. Create anintvariable to hold the highest index andinitializeit by calling thegetHighestIndex(parameter HERE)method and storing the return in your variable.*Remember to send the scores array as aparameterto the method.

    6. Call theprintHighestStudent(3 parameters HERE)method and pass the names, scores, and highest index asparametersto the method. You do not need to "store" as there is no return value in this method. Justcallthe method.



  11. Submit your code in Code Check and check the tests and correct any error messages or output formatting issues.

  12. Once you have everything correct, download thezipped fileand then upload to this Assignment folder.


Testing and Submitting


Once you have thoroughly tested your program, pleaseuploadthezipped fileonlyto thisProgramming Project 3folder.


You will be graded on:



  1. Neatness of code and use of proper indentation of 4 spaces, 8 spaces, etc. This is theCheckstylepart of yourReport.

  2. Commenting of code - including class comment, @author, @version, and code comments.This is theCheckstylepart of yourReport.

  3. Good use of constant and variablenames- they should bedescriptivenames and not individual characters or abbreviations. Ex. FINAL_COST or firstName.This is theCheckstylepart of yourReport.

  4. Output is correct and matches the Sample Output forall teststhat executed on your code in Code Check.This is theTest 1, Test 2, etc.part of yourReport.They must say "Pass".

  5. My visual inspection of your code. I will be checking for good variable and constant names and well as good indenting of code. Instructor reserves the right to make adjustments to the Code Check score based on inspection.

Nov 23, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here