{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

HW05 Solution1 - d = d 1 else f = f 1...

Info icon This preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 // Solution to Homework #5, Problem #1 public class HW5_1 { public static void main(String[] args) { int[] grades = {90, 60, 85, 73, 88, 92, 100} // Basic solution int a = 0 // Number of A's int b = 0 // Number of B's int c = 0 // Number of C's int d = 0 // Number of D's int f = 0 // Number of F's for (int i = 0 i < grades.length i++) if (grades[i] >= 90) a = a + 1 else if (grades[i] >= 80) b = b + 1 else if (grades[i] >= 70) c = c + 1 else if (grades[i] >= 60)
Image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: d = d + 1 else f = f + 1 System.out.println("A's: " + a) System.out.println("B's: " + b) System.out.println("C's: " + c) System.out.println("D's: " + d) System.out.println("F's: " + f) // // Advdanced solution // int counts = new int[ // for (int i = 0 i < grades.length i++) // if (grades[i] < 60) // counts[0]++ // else { // int modifiedGrade = (int) ((grades[i] - 50) / 10.0) // // System.out.println("A's: " + a) } }...
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern