CS 1301 Lab 4

100 Points

Attendance is worth 10 points.

(50 points) Individual Problem: Points in a rectangle
For this program you need to submit the source code (.java), including prolog and design at the beginning of the program, in comments.

Write a program that prompts the user to enter a point (x, y) and checks whether the point is within the rectangle centered at (0, 0) with width 10 and height 5. For example, (2, 2) is inside the rectangle and (6, 4) is outside the rectangle, as shown in the Figure.

(Hint: A point is in the rectangle if its horizontal distance to (0, 0) is less than or equal to 10 / 2 and its vertical distance to (0, 0) is less than or equal to 5 / 2.).
Here are 2 sample runs of the program:

Sample 1:
Enter a point with two coordinates: 2 2
Point (2.0, 2.0) is in the rectangle

Sample 2:
Enter a point with two coordinates: 6 4
Point (6.0, 4.0) is not in the rectangle

(40 points) Team Problem: Fractions
Write a program that prompts the user to enter the positive integer numerator and denominator of a fraction number and determines whether it is a proper fraction and improper fraction. A fraction is proper if its value is strictly less than one, otherwise it is improper. For an improper fraction number, display its mixed fraction in the form of a + b / c if b % c is not zero; otherwise, display only the integer. For more information on proper/improper fractions, see this link.

Below are some sample runs of the program:

Sample 1:
Enter a numerator: 16
Enter a denominator: 3
16 / 3 is an improper fraction and its mixed fraction is 5 + 1 / 3.

Sample 2:
Enter a numerator: 6
Enter a denominator: 7
6 / 7 is a proper fraction 

Sample 3:
Enter a numerator: 6
Enter a denominator: 2
6 / 2 is an improper fraction and it can be reduced to 3

To successfully complete this lab you should: