Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * This method will take in a first and last name and a hw average and a project average and finds the grade
- * The grade is made up of 40% hw, 60% projects. The name will be abbreviated as shown below
- * So if findGrade("Jeff", "Borland", 90, 80) would print out Student JB has a 84.0 in the class
- * The 84 is because 40%*90 + 80*.60 = 84.0
- */
- public void findGrade(String firstName, String lastName, double hw, double project)
- {
- String firstInitial = firstName.substring(0,1);
- String lastInitial = lastName.substring(0,1);
- String abbreviatedName = firstInitial + lastInitial;
- double homeworkGrade = hw * 0.4f;
- double projectGrade = project * 0.6f;
- double finalGrade = homeworkGrade + projectGrade;
- System.out.println(abbreviatedName + " has a " + finalGrade + " in the class");
- }
Add Comment
Please, Sign In to add comment