Program to translates a number into the closest letter grade

Assignment Help JAVA Programming
Reference no: EM13162684

Write a 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+.

Use 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());
   }
}

 

 

Reference no: EM13162684

Questions Cloud

Add a sentinel command to stop the loop : add a sentinel command to stop the loop. When the program is compiled, It'll ask the user to type in a palindrome. I want the user to type EXIT to end the loop.
Required value for the move command : Shape_index is a required value for the move command. It is the index of the shape in the shape data arrays that you wish to move. It should range between 0 and MAX_SHAPES - 1. Be sure to validate the index.
Write a function that takes a list of integers as argument : Write a function that takes a list of integers as argument and returns a pair consisting of the sum of the even positions and the sum of the odd positions of the list. You should not use any auxiliary functions.
Receiver decide which symbol was originally sent : How can a receiver decide which symbol was originally sent when a received "point" lies somewhere in between other points in the diagram?
Program to translates a number into the closest letter grade : Write a 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
Program should assign a seat in the first class : If a person enters 1, your program should assign a seat in the first class (rows 1 - 3). If a person enters 2, your program should assign a seat in business class (rows 4 - 7). If a person enters 3, your program should assign a seat in economy class ..
Write a version of sumpairs : Write a version of sumPairs  that sums each component of the pairs separately, returning a pair consisting of the sum of the first components and the sum of the second components. So basically [(3,1)(10,3)] would return (13,4).
The program reads in names : Write a program and include the following methods. The program reads in names and ages (use 2 parallel arrays, maximum size 50) from a file called Stuff.dat.
Design an adt for a two-color : Design an ADT for a two-color, double-stack ADT that consists of two stacks one "red" and one "blue" and has as its operations color-coded versions of the regular stack ADT operations.

Reviews

Write a Review

JAVA Programming Questions & Answers

  User session mgr - socket and thread programs

User Session Mgr - Socket and Thread Programs

  Write a program that asks a user for a file name and prints

Write a program that asks a user for a file name and prints the number of characters, words, and lines in that file.

  Write various bindings to determine semantics

Write the various bindings that are required to determine the semantics when statement is executed. For each binding, indicate binding time used for language. Describe your answer.

  Develop a graphical user interface based java program

Develop a Java program that can communicate with a real SMTP email server for sending emails. TNE 60003 - introduction to network programming, You program should provide a GUI and can successfully send the SMTP commands to the mail server

  Create java applet to input miles driven and gallons used

Create the Java applet which will input miles driven and gallons used (both as integers) for each tankful. Program must compute and display miles per gallon obtained for each tankful.

  Java applet to find how much federal tax we need to pay

Write a java applet to determine how much federal tax we need to pay assuming the tax rate is 12%.  Ask the taxable income.

  The game of pig

Write a program that allows a single player to practice the game (that is, there will be no opponent, just a single player). Play 5 turns in the game to get a total score for the player. Refer to the sample output below for a detailed example.

  Write a recursive method to produce a pattern

Write a recursive method to produce a pattern of n lines of asterisks.

  Record managing system application

Build a student record managing system application

  Pass in the number of gallons on board

public float usefulLoad() // this is the grossWeight - emptyWeight public float usefulLoadWithFuel( in gallons ) // this is the useful load - gallons x 6. The programmer user will pass in the number of gallons on board.

  When the user presses a button

When the user presses a button, get the text from text field. Now extract the words from the text one at a time and find the largest word of length 4 or more. Let's call this largest word X for now. In response, create a question based on the length ..

  How to count number of objects (instances) created

How to count number of objects (instances) Created, use java code and please be descriptive

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd