4 Replies - 1652 Views - Last Post: 05 May 2013 - 11:14 AM Rate Topic: -----

#1 hansma  Icon User is offline

  • New D.I.C Head

Reputation: -3
  • View blog
  • Posts: 10
  • Joined: 04-May 13

A program that displays letter grades?

Posted 04 May 2013 - 08:17 PM

Im a little new to the programming and i was wondering if anyone could help me figure this out?
thanks in advance.


Write a program that asks the user to enter the number of students he/she wishes to calculate exam grades for. You will use this value create an array of scores. Have the user enter the scores for each student, storing these values in an array.

The letter grades will be determined by the scores entered. The highest score will be an A, any score within 10 points of the highest score will also be an A, and so on, based on the table below:

Grade is A if score is => best - 10
Grade is B if score is => best - 20
Grade is C if score is => best - 30
Grade is D if score is => best - 40
Grade is F for any score less than D.

Display the scores and letter grades as entered:

Student 1 score is 66.0 and grade is C
Student 2 score is 88.0 and grade is A
Student 3 score is 77.0 and grade is B
Student 4 score is 56.0 and grade is D


Now, I need to sort the grades AND display the scores associated to these students from highest to lowest, as in:

Student 2 score is 88.0 and grade is A
Student 3 score is 77.0 and grade is B
Student 1 score is 66.0 and grade is C
Student 4 score is 56.0 and grade is D

Is This A Good Question/Topic? 0
  • +

Replies To: A program that displays letter grades?

#2 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 9573
  • View blog
  • Posts: 36,253
  • Joined: 12-June 08

Re: A program that displays letter grades?

Posted 04 May 2013 - 08:21 PM

Okay dokey.. so what is your question? I am guessing it is the implied "where do I start?"? Try breaking the problem down. So you need to be able to get user input.. how do you do that? You need to get multiple chunks of input, and store in an array... how do you declare an array and put values in it? Can you add up the numbers in the array and divide by how many items are in the array? Sure.. then you should probably output the values to the console..

Break a problem down into manageable pieces!
Was This Post Helpful? 0
  • +
  • -

#3 hansma  Icon User is offline

  • New D.I.C Head

Reputation: -3
  • View blog
  • Posts: 10
  • Joined: 04-May 13

Re: A program that displays letter grades?

Posted 04 May 2013 - 08:25 PM

That helps a little but i am still confused as to how you can get all the grades and then put them from highest to lowest
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 9573
  • View blog
  • Posts: 36,253
  • Joined: 12-June 08

Re: A program that displays letter grades?

Posted 04 May 2013 - 08:26 PM

You read in a value from the console.
You store that value in an array.
You use a sort algorithm on the array. I am guessing, at this stage of the game, bubble sort?
Was This Post Helpful? 0
  • +
  • -

#5 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8346
  • View blog
  • Posts: 31,908
  • Joined: 06-March 08

Re: A program that displays letter grades?

Posted 05 May 2013 - 11:14 AM

The Arrays class has a sort() method that you can invoke on an Array of Object
So if you create a class Strudent that contains the name of the Sudent, it's grade and score you could sort it if its implements Comparable.

Start by the beginning, we'll fix that sorting part later on.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1