CS 1400 Lab #15: Triangle Calculator


Objectives:

To create a program that correctly uses a Form Class and a Domain Class of your design.

Study Material

You may want to go back and review the study material in labs 12, 13, and 14.

Writing the program

In this program you will create an object of the Triangle class that you designed in lab #14 to do the calculation work of the program. This is what we have called the domain class. You will need to think about how to make your Form work with the object you create from your Triangle class. You may need to review the instructions for lab #14, and take another look at the sample program provided in lab #14 to do this. Just keep in mind that your Form class must

  • Declare a reference variable in which to store the address of the Triangle object that you will create.
  • Create an object of the Triangle Class.
  • Get input from the user, and send it to the Triangle object where it will be stored in data members of the Triangle class.
  • Ask the Triangle object to calculate and return the value of the hypotenuse of the triangle and the area of the triangle. Then display this data in some TextBoxes.

Questions

When you submit this lab, add some comments to your submission that answer the following questions:

(1) In the program for this lab, you need a reference variable that will hold a reference to a Triangle class. Where does the declaration of this variable belong: in the Form class, or in the Triangle class?

(2) Why is this reference variable required?

File(s) to Submit:

Place your complete project folder for this assignment in a zip file and name the zip file lab_15_your-initials_V1.0.zip. For example, I would name my file lab_15_RKD_V1.0.zip. Submit this assignment as Lab #15 on Canvas. Do not submit any other files.

Grading Guidelines

Description Points possible

Assignment meets grading guidelines:
Assignment has been properly submitted to Canvas and your code meets the style guidelines.

2

Your program contains a Form class that manages the user interface, and an application class that does the work of the application. The program works correctly.

3

You have correctly answered the questions in this lab.

2
Total 7