A program that displays letter grades?

Page 1 of 1

4 Replies - 3156 Views - Last Post: 05 May 2013 - 11:14 AMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=320316&amp;s=3f7701fbdbb802d72f4e610fa66cf30e&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

#1 hansma

• New D.I.C Head

Reputation: -3
• 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

• Suitor #2

Reputation: 13941
• Posts: 55,670
• 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

• New D.I.C Head

Reputation: -3
• 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

• Suitor #2

Reputation: 13941
• Posts: 55,670
• 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

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

Reputation: 8378
• Posts: 31,956
• 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

 .related ul { list-style-type: circle; font-size: 12px; font-weight: bold; } .related li { margin-bottom: 5px; background-position: left 7px !important; margin-left: -35px; } .related h2 { font-size: 18px; font-weight: bold; } .related a { color: blue; }