February 19, 2017

Homework Help: Computer Science

Posted by Jim on Wednesday, May 21, 2008 at 3:14am.

I need help with these assignments.

"Write a program to read a list of exam scores (integers in the range 0 to 100) and to output the total number of grades and the number of grades in each letter-grade category (90 to 100 = A, 80 to 89 = B, 70 to 79 = C, 60 to 69 = D, and 0 to 59 = F). The end of the input is indicated by a negative score as a sentinel value. (The negative value is used only to end the loop, so do not use it in the calculations.) For example, if the input is

The output would be
Total number of grades=14
Number of A’s=1
Number of B’s=4
Number of C’s=6
Number of D’s=2
Number of F’s=1"

"Write a Rectangle class.
This class represents Rectangles. Each Rectange has the X and Y coordinates of its center point (as doubles) and its width and height (as double values, too). No other values should be stored! This means no area, no perimeter!

The class should have the following constructors and methods:
1. a constructor that takes X, Y, width, and height as arguments;
2. a constructor that takes only width and height as arguments;
3. a default constructor;
4. a method setCenter that takes X and Y as arguments;
5. a method setWidth that takes a width value;
6. a method setHeight that takes a height value;
7. a method getX that returns the X coordinate;
8. a method getY that returns the Y coordinate;
9. a method getWidth that returns the width value;
10. a method getHeight that returns the height value;
11. a method getArea calculates the area of the rectangle and returns it;
12. a method getPerimeter it calculates the perimeter of the rectangle and returns it;
13. a method toString that creates a String that includes the X, Y center coordinates, width, and height, and returns the string. This method does not use System.out.println() itself. It returns a String value to the caller.

Write an application ( to test your Rectangle class.
Your Application should test all the constructors and methods."

Answer This Question

First Name:
School Subject:

Related Questions

More Related Questions