Public double getNumericGrade() - Returns the numeric grade in the range 0.0 <= grade <= 4.0.Ĭode to test the program goes in Program. Public String getLetterGrade() - Returns the grade as a String. Public Grade(String grade) - Constructor that sets the grade as a String. This object will have a constructor that takes one argument and the following two methods: NOTE: You may not hard-code the return value for +/- grades, but must add or subtract 0.3. Note that an "A+" is still 4.0 points and an "F+" or "F-" is still 0 grade points. The + sign adds 0.3 to the grade points and the - sign subtracts 0.3. The letter values are worth 4.0 grade points for an A, 3.0 for a B, 2.0 for a C, 1.0 for a D, and 0 for an F. it will use the system default encoding). A, B, C, D, F) followed by an optional sign (e.g. If you use 'File' > 'Open' to open files in jGRASP, you can specify the encoding on the open dialog (if you double click, drag-and-drop, etc. This grade has the form of a letter (e.g. You are to write a program that will take a grade as a String. Hello, I need help with this simple Java program. Write methods to display the values in each Student field. Include a method to compute the grade point average field by dividing points by credit hours earned. A Student also has a field for grade point average. (For example, many schools compute grade point averages based on a scale of 4, so a three-credit-hour class in which a student earns an A is worth 12 points.) Include methods to assign values to all fields. Create a class named Student that has fields for an ID number, number of credit hours earned, and number of points earned. Save the application as ShowStudent2.java.Ī. Write a program that demonstrates that the constructor works by instantiating an object and displaying the initial values. The constructor should initialize each Student's ID number to 9999, his or her points earned to 12, and credit hours to 3 (resulting in a grade point average of 4.0). Create a constructor for the Student class you created. Save the application as ShowStudent.java.Ĭ. Compute the Student's grade point average, and then display all the values associated with the Student. Write a class named ShowStudent that instantiates a Student object from the class you created and assigns values to its fields.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |