Purchase Solution

Java Program: Convert Numerical Grade To Closest Letter Grade

Not what you're looking for?

Ask Custom Question

Write a Java program that translates a number into the closest letter grade. For example, the number 2.8 (which might have been the average of several grades) would be converted to B-. Break ties in favor of the better grade; for example, 2.85 should be a B. Any value >= 4.15 should be an A+.

Write a class Grade with a method getLetterGrade.

Here is a sample program run:

Enter a numeric value:
2.85
Letter grade: B

Use the following class as your main class:

import java.util.Scanner;

/**
This class prints the letter grade corresponding to a numeric value given
by the user.
*/
public class GradePrinter
{
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);

System.out.println("Enter a numeric value:");
double numGrade = in.nextDouble();

Grade g = new Grade(numGrade);

System.out.println("Letter grade: " + g.getLetterGrade());
}
}

Purchase this Solution

Solution Summary

The expert uses a java program to concert numerical grades to closest letter grades.

Solution Preview

Please see the attachments for complete solution.

// Grade.java

public class Grade {
private double numGrade;

public Grade() {}
public Grade(double input) {
this.numGrade = input;
}

public String getLetterGrade() {
String letterGrade = ...

Purchase this Solution


Free BrainMass Quizzes
Basic UNIX commands

Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.

Javscript Basics

Quiz on basics of javascript programming language.

Inserting and deleting in a linked list

This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.

Word 2010: Table of Contents

Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.

Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.