Friday 15 June 2012

java - Calculate array of grades -


I need to complete the following methods in the category below, with Part A and Part B The class should calculate the GPA for array range, and add bonus to the AP class grade. P indicates an AP grade, for example "B-P" is an AP grade, and "B-" is a normal grade. For the part, I should have the result of 1.7122 for "CP", and for Part B, it must be processed on the whole grade grade and get the result of 3.455333 .....

It was told which parts are parts A and B. and they have been labeled using comment. I have also commented on the labeling where I think the remaining code should go to A and B. to calculate the results.

Can someone explain how to do this and what method should be used?

This is my code (I know that it is formatted incorrectly, it is not in J serer, but I could not copy it correctly here):

  public class GPAFreeResponse {personal string} grade = {"AP", "B + P", "BP"}; Private string [] ltrGrades = {"A", "A", "B +", "B", "B", "C +", "C", "C", "D", "E"}; Private Double [] DGRS = {4.0, 3.7, 3.3, 3.0, 2.7, 2.3, 2.0, 1.7, 1.3, 1.0, 0.0}; Private Double [] bonusPts = {.0488, .0488, .0366, .0366, .0366, .0122, .0122, .0122, .0061, .0061, 0.0}; Private double degradation; Public GPAFreeResponse () {dGrade = Calculation Grade ("C-P") + Calculation Bonus ("C-P"); // Part One System.out.println ("Part 9a):" + DGRAD); DGrade = Calculation GPA (); // Part B System.out.println ("Part (B):" + DGRAD); } Public Double Countgpa () // Part B {Double dResult = 0.0; Double DTLPP = 0.0; Double debonPT = 0.0; // More code goes here dResult; } Public double countdown (string straight) / / one section {double dResult = 0.0; // More stuff here dResult return; } Public Double Count Bonus (String Straight) // Part One {Double dResult = 0.0; // More goods return dResult here; } Make an example of public static zero main (string [] args) // // GPA new GPAextra (); }}    

I'm not sure how much you know Java but since it is homework I will write it in pseudocode and leave it to translate it to java. Tell me if you are really stuck and we will be happy to give you hand with a specific code.

So, we will start with the calculation. Grad what you want to do is loop through all the elements of ltrGrades, unless you are one that matches the first two letters of your input, Which will give you the indicator of the letter grade you want. After that, you only have to return the value to the same index dGrades. Therefore, repeat the first string,

 , which is in the form of substrate 0 to 1/0, you have to do this work how I actually implement this duplication (i From 0 to the length of ltrGrades) if (i'th element of the first two ltrGrades is equal to) then i returned the i'th element of the dGrades // cat case where it was not returned 0.0   < P> Once you know that it is working, or if it is not at all obvious.  

EDIT: Before someone says that this is not the easiest way, I just describe the basic algorithm functionality that you are looking for.

EDIT 2: Here is a breakdown of how you will get each individual section.

First of all, get the substrings of strings check for information about substrings, but basically what you want

  string first two = str. Springing (0,2);   

Next, again via ltrGrades, then for something like

  (int i = 0; i & lt; ltrGrades.length; i + Then, to check if the i'th element of ltrGrades is the sub-base you want,  
  if (firstTwo == lrtGrades [I]) Finally, if it is, then you will return the element of i gaara, so  
  return dGrades [i]  / Code>  

If she is not quite right, then she remembers completely, so I'm sure there are some minor mistakes in it, but you Should Ichar. Tell me when you have to work.

No comments:

Post a Comment