[Solved] CS 151 Programming Assignment #12

$25

File Name: CS_151_Programming_Assignment_#12.zip
File Size: 310.86 KB

SKU: [Solved] CS 151 Programming Assignment #12 Category: Tag:
5/5 - (1 vote)

Goal: Compute a histogram of letter grades entered from the keyboard.Create a class named GradeHistogram that includes a method inputData () that reads a series of letter grades (A, B, C, D, F) from the user and counts the number of times each grade occurs. The grades are entered one per line. Enter a Z to signal the end of input. The grades can occur in any order. Accept both upper and lower case. For example A and a are the same grade. Dont assume any upper limit for the number of grades.Count the number of times a letter that is not a grade has been entered. The method showData() writes out the histogram.Write the program with a class definition of GradeHistogram and a separate class definition GHTester that contains the static main() method. The main() method creates a GradeHistogram object and call that objects inputData () method to read and process the data.Store the grade frequencies in an array of integers. Use a separate variable to contain the number of errors. You must use an array for this program since the purpose is practice with arrays.Do not write this program with just a single class. Write a driver class HistoTester which contains main(), which instantiates a GradeHistogram and uses its methods. Here is an example of the program working:Enter Grade: CEnter Grade: AEnter Grade: DEnter Grade: cEnter Grade: SEnter Grade: aEnter Grade: ZGrade Frequency A 2B 0C 2D 1F 1errors 1Class Average: 2.6Expect much more input than shown here.You will need: A while loop that keeps going until the user inputs a Z. You may also need to use the charAt() method of the String to get a single character from the users input.Program Outline:import java.util.*;public class GradeHistogram{. . . instance variables . . .public void inputData(){fill in here}public void showData(){fill in here}public double classAverage(){fill in here}}// Driver classpublic class HistoTester{public static void main ( String[] args ){GradeHistogram gradeHist = new GradeHistogram();gradeHist.inputData();gradeHist.showData();. . .}}What to turn in: Turn in GradeHistogram.java and HistoTester.java. At the top of yoursource files include your name and date in the comment header.

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] CS 151 Programming Assignment #12
$25