Tuesday
October 21, 2014

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
98
87
86
85
85
78
73
72
72
72
70
66
63
50
-1

The output would be
Total number of grades=14
Number of As=1
Number of Bs=4
Number of Cs=6
Number of Ds=2
Number of Fs=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 (RectangleTest.java) to test your Rectangle class.
Your Application should test all the constructors and methods."

Answer this Question

First Name:
School Subject:
Answer:

Related Questions

visual basic programming - Write a Visual Basic program that will calculate the...
computer science - Class scores: Write a program that calculates the total grade...
computer science - Write an Assembly program to determine the price of a car ...
Computer Science - 1.Write an Assembly program that reads in a number of cents. ...
Java Help - I am just starting out in programming. If someone could help me with...
Programming - Write a program that would calculate and display the results for ...
computer science - write a program that prompts the user to input three numbers...
computer science - Write a program that prompts the user to input three numbers...
Computer - Home work:- Write a program to read 5 records consists of first name...
Programing - Write a full program that reads in an arbitrary sequence of ...

Search
Members