Right Angled Triangle (Due 20 Feb 2004)

In this program you will prompt the user to enter 3 sides of a triangle. You will determine if the triangle is a right angled triangle. You will write out a message stating that the triangle is right angled or not. You MUST use the BufferedReader to do your input and not JOptionPane as suggested in the book. Assume that the sides are integers. Use the Pythagorean theorem to arrive at your answer.

For one set of inputs, this is what you will see on your screen:

Enter 1st side: 3
Enter 2nd side: 4
Enter 3rd side: 5

The triangle is right angled triangle.

For another set of inputs, this is what you will see on your screen:

Enter 1st side: 5
Enter 2nd side: 6
Enter 3rd side: 7

The triangle is not right angled triangle.

The class that you will be writing will be called RightTriangle. We will be looking at good documentation, descriptive variable names, and adherence to the coding convention mentioned below. Your file RightTriangle.java will have the following header:

/*
  File: RightTriangle.java

  Description:

  Student Name:

  Student UT EID:

  Course Name: CS 303E

  Unique Number: 

  TA:

  Date Created:

  Date Last Modified:

*/

Simple Sum and Average (Due 20 Feb 2004)

You will prompt the user enter integer numbers. To end the user will type 0 (zero). At the end you will print out the number of integers entered, their sum and average. You MUST use the BufferedReader object to read input from the console and not JOptionPane as suggested in your book. Even though the numbers entered are integers and so is the sum, the average is of type double.

For one set of inputs, your output on the screen will look like:

Enter a number (Type 0 to quit): 1
Enter a number (Type 0 to quit): 2
Enter a number (Type 0 to quit): 3
Enter a number (Type 0 to quit): 0

You have entered 3 numbers.
The sum is 6
The average is 2

For another set of inputs, your output on the screen will look like:

Enter a number (Type 0 to quit): 0

You have entered 0 numbers.
The sum is 0
The average is 0

The class that you will be writing will be called SimpleSum. We will be looking at good documentation, descriptive variable names, and adherence to the coding convention mentioned below. Your file SimpleSum.java will have the following header:

/*
  File: SimpleSum.java

  Description:

  Student Name:

  Student UT EID:

  Course Name: CS 303E

  Unique Number: 

  TA:

  Date Created:

  Date Last Modified:

*/

You will follow the standard Java Coding Conventions. You can either view the HTML page or download the PDF or Postscript and print it out. There is a modification that I would like to make to the standard coding conventions. Please align the opening and closing braces vertically so that you can easily make out the blocks of code. For example:

if ( x > 5 ) {
  a = b + c;
}

vs.

if ( x > 5 )
{
  a = b + c;
}

Use the turnin program to submit your RightTriangle.java and SimpleSum.java files. The TAs should receive your work by 5 PM, Friday, 20 February 2004.