Ask a question from expert

Ask now

CIS 120 Exam 2 Programming Question.

1 Pages467 Words165 Views
   

Added on  2019-09-18

CIS 120 Exam 2 Programming Question.

   Added on 2019-09-18

BookmarkShareRelated Documents
CIS 120 Exam 2 Programming QuestionCreate a new Project and Class called Exam2_YourName. Please write your name in the class name. Your program will have a main method and two other methods called gradeCalculator and calculateAverage. Submit all the .java file called Exam2_YourName. Also ,copy and paste your code into a .docx file and upload the file as well. Please use the exam2 dropbox to submit your code.Your main method does the following :1)Create a 5-element array called subjectMarks that will carry numeric marks (double data type) of a student in five different subjects. Each mark can be a real number such as 40.5, 35.6 etc. Declare the array appropriately.2)Fill the array with values: Prompt the user to enter the student’s mark in each subject, one by one and use those values to fill the elements of the subjectMarks array one by one.3)Call the calculateAverage method and pass on the subjectMarks array as a parameter. This method will return the average mark of the student. Print out the average mark of the student on the console with proper comments. Use any required variable (for example- name it avgMark) to store the average mark value returned by the method.4)Call the gradeCalculator method and pass on to this method as a parameter, the variable that contains the average mark (avgMark as obtained in step 3). This method (gradeCalculator ) calculates the letter grade based on the student’s average and returns a String that will be the letter grade of the student. Print out this letter grade into the console. You may use a variable name letterGrade to hold the letter grade returned by the method. Write the code for the calculateAverage method. The calculateAverage method has the following features:1)This method will take in as a parameter/argument the array containing marks of the student (as in subjectMarks array). 2)This method returns a double value corresponding to the average marks of the student. You may declare a double variable called avgMark that will contain the average marks.3)This method calculates the average marks by taking one element of the array at a time, adding them to find the total marks. You may use a variable called totalMark to hold the total mark. After adding all the elements (,or marks), divide the total marks with the length of the array ( which givesthe number of subjects), to obtain the average marks. Return the average marks carried by the variable avgMarks. Anastasia Declin
CIS 120 Exam 2 Programming Question._1

End of preview

Want to access all the pages? Upload your documents or become a member.

Related Documents
Visual Studio Project | Assignment On C# Console Application
|3
|1002
|81

SIT105 Critical Thinking and Problem Solving | Report
|9
|1576
|285

Java program to grade students based on quizzes and exams
|5
|790
|169

CSC121 PYTHON Programming Lab
|4
|988
|573

Please use the file provided for coding..
|2
|959
|64

Business Information Systems Assignment
|3
|1669
|208