Description of Project 3 Purpose: In Project 3, we are going to learn how to useMethodsto make our code more effective and handle "separation of concerns". Think ofmethods like functions - each method...

1 answer below »

Description of Project 3 Purpose:


In Project 3, we are going to learn how to useMethodsto make our code more effective and handle "separation of concerns". Think ofmethods like functions - each method handlesone specificproblem or task, but is able to be called/reused as many times as needed. The purpose of this project is to prompt the user for category weights (of his/her grade) and then asks the user to input his/her grades for each category. It will then it find the grade average of each category and use them to calculate the user's final grade average and letter grade.


We will break our code down into several methods that each haveone
specificpurpose. One to give an introduction, one to handle the homework grades, one to handle the test grades, one to handle the midterm grade, one to handle the final exam grade, one to calculate the final grade average, and one to find the letter grade associated with the given numerical grade. We will learn how to call a method andstoreitsreturn valueas well aspassthese return values to methods asparameters.Don't get too bogged down in the terminology. Think of methods as you would math functions - you put a value in and you get a value out. We store these values invariablesin math just as in Java.


For example:
f(x) = 3x + 2
x = 4
y = f(4) = 3(4) + 2 = 14
Think of 'x' like our parameter value. We "sent" it to f(x) andstoredthe result in 'y'. In Java,


String letter = getLetterGrade(gradeAverage);


In this case,gradeAverageis like 'x' - aparameterwe are sending to the methodgetLetterGrade. The method willreturna value will be store it in ourlettervariable, which is like 'y'.


Methods


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


Sample Output 1:

Welcome to the Grade Calculator!This program will input your homework, quizzes, tests,and final exam and calculate your average.How many homework grades to be entered?:4Grade 1:85.6Grade 2:92Grade 3:84.7Grade 4:94.3How many tests grades to be entered?:3Grade 1:88Grade 2:89.9Grade 3:97Please enter your midterm exam grade:88.6Please enter your final exam grade:92.1Your final grade is: 90.79Great job - You earned an A


----jGRASP: operation complete.




Sample Output 2:

Welcome to the Grade Calculator!This program will input your homework, quizzes, tests,and final exam and calculate your average.How many homework grades to be entered?:3Grade 1:78Grade 2:76.4Grade 3:73.8How many tests grades to be entered?:2Grade 1:86.2Grade 2:75Please enter your midterm exam grade:71.3Please enter your final exam grade:79Your final grade is: 77.58OK job - You earned a C


----jGRASP: operation complete.



Instructions Project 3:



  1. We will now be usingmethodsandforloops(no while here) to make our program more efficient and to learn how methods work in practice.

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

  3. If using and IDE (jGrasp or Eclipse), create a new class file namedGradeCalculatorUsingMethods.java(optional)

  4. You will be filling in code everywhere you see the ellipses (. . .) in the Code Check 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 with methods, 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.



  6. In thegiveIntro()method, add statements to output the welcome message (see Sample Output for formatting and message)

  7. In thegetHomeworkAvg()method:

    1. Complete the method comment and @tag

    2. Read in the number of homework grades and store in a variable (already completed).

    3. Create a variable to hold the sum of homework grades (already completed).

    4. Construct afor loopwith conditions that will read in the given number of homework grades.

      • Inside the for loop, prompt the user to enter the grade (pay special attention to the Sample Output of "Grade1", "Grade2", etc.)

      • Add the grade entry to the homework sum



    5. Outside the for loop, calculate the homework average.

    6. Return the average (already completed)



  8. In thegetTestAvg()method:


    1. Complete the method comment and @tag

    2. Read in the number of homework grades and store in a variable (already completed).

    3. Create a variable to hold the sum of test grades (done).

    4. Construct afor loopwith conditions that will read in the given number of test grades

      • Inside the for loop, prompt the user to enter the grade (pay special attention to the Sample Output of "Grade1", "Grade2", etc.)

      • Add the grade entry to the test sum



    5. Outside the for loop, calculate the test average.

    6. Returnthe test average.


  9. In thegetMidtermExamGrade()method:

    1. Complete the method comment and @tag

    2. Prompt the user to enter the midterm exam grade and store in an appropriate variable. *No loop needed.

    3. Returnthe midterm exam grade.



  10. In thegetFinalExamGrade()method:

    1. Complete the method comment and @tag

    2. Prompt the user to enter the final exam grade and store in an appropriate variable. *No loop needed.

    3. Returnthe final exam grade from the method.



  11. In thecalculateGradeAverage()method:

    1. Complete the method comment and all @tags (must use 1 @param foreachparameter - no grouping - and 1 @return tag)

    2. Create a variable and calculate the grade average using only parameter variables and constants (no magic numbers!)

    3. Returnthe grade average.



  12. In thegetLetterGrade()method:

    1. Use a series of if/else if/else statements to determine which String message should beassignedto theletterGradevariable (NOTE: We are not using print(ln) statements here! You will assign the entire String to the variable and then it will be returned as the last statement of the method).

      • An 'A' should returnGreat job - You earned an A, a 'B' should returnGood job - You earned a B, a 'C' should returnOK job - You earned a C, a 'D' should returnOh no - You earned a D, and an 'F' should returnSorry - You earned an F.



    2. TheletterGradeis returned from the method.



  13. Now - go back to themain method:

    1. Call the method to introduce the application to the user.

    2. Call the 4 methods to obtain the averages and grades for homework, tests, midterm, and final exam andstorethe returned values in 4 appropriate variables.*I have completed the call to the homework method for you.

    3. Call thecalculateGradeAverage()method andpassthe 4 variables you created in Step 12.2 (above) as parameters for homework, tests, midterm, and final exam to the method. Make sure andstorethe returned value in an appropriate variable.

    4. Use aprintfstatement to output the grade average to 2 decimal places.

    5. Call thegetLetterGrade()method andpassthe grade average to the method (NOTE: we are going to "nest" this method call inside ourprintlnstatement to understand the different ways we can call a method and get the return value. Basically, if we only want to output the return value and not "store" it, we can "nest" the method call inside a print(ln) statement).



  14. Submit your code and check the tests and correct any error messages or output formatting issues.

  15. 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. Correct calculations using variables and constants (i.e. the math is correct). This is theTest 1, Test 2, etc.part of yourReport.

  6. 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.


ALL DONE!! Great job!

Answered Same DayNov 09, 2021

Answer To: Description of Project 3 Purpose: In Project 3, we are going to learn how to useMethodsto make our...

Aditya answered on Nov 09 2021
127 Votes
META-INF/MANIFEST.MF
Manifest-Version: 1.0
Created-By: 11.0.11 (Oracle Corporation)
Name: report.
html
SHA-256-Digest: YZ/xO8owp7CraIQW6ZUFvy7kny18JhowE9YI1okUwGA=
Name: GradeCalculatorUsingMethods.java
SHA-256-Digest: GyfddZ8yBdWRmn5l6V23ub3GvAoO4P34oyJxLsFCBq0=
META-INF/SIGNER.SF
Signature-Version: 1.0
Created-By: 11.0.11 (Oracle Corporation)
SHA-256-Digest-Manifest: eYuuEmhYpZAQsHS/tdRHQNTGM8Obuz+/pz/utAA1znA=
SHA-256-Digest-Manifest-Main-Attributes: /DCWd8kOyL8Hb2b8Qc47nzARKf1iFMG
5CCGWqjTax8g=
Name: report.html
SHA-256-Digest: HnaxMvqHSUUP19qAnoN09iVcRyCgyxtsjA+AywTyqJg=
Name: GradeCalculatorUsingMethods.java
SHA-256-Digest:...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here