To create a read-only property

Assignment Help Programming Languages
Reference no: EM13933197

(Triangle Creator Application) Create an application that allows the user to enter the lengths for the three sides of a triangle as

Integers. The application should then determine whether the triangle is a right triangle (two sides of the triangle form a

90-degree angle), an equilateral triangle (all sides of equal length) or neither. The application's GUI is completed for you (Fig.

19.45). You must create a class to represent a triangle object and define the event handler for the Create Button.

2134_bb.png

a) Copying the template to your working directory. Copy the directory C: \Exampl es\Tutori al 19\Exercises\Tri angl e to your C:

\Si mpl yVB2008 directory.

b) Opening the application's template file. Double click Tri angl e. sl n in the Tri angl e directory to open the application.

c) Creating the Triangle class. Add a class to the project, and name it Tri angl e. This is where you define the properties of the

Tri angl e class.

d) Defining the necessary constructor and properties. Define a constructor that takes the lengths of the three sides of the

triangle as arguments. Create three properties that enable clients to access and modify the lengths of the three sides. If the

user enters a negative value, that side should be assigned the value zero and the display updated.

e) Adding additional features. Create two more properties in the Tri angl e class- one determines whether the sides form a

right triangle, the other an equilateral triangle. Use the Pythagorean theorem (a 2 + b 2 = c 2) to test for a right triangle.

These properties are considered read-only, because you would naturally define only the Get accessor. There is no simple Set

accessor that can make a triangle a right triangle or an equilateral triangle without first modifying the lengths of the triangle's

sides. To create a read-only property (where the Set accessor is omitted), precede keyword Property with the keyword ReadOnl

y.

f) Adding code to event handler. Now that you have created your Tri angl e class, you can use it to create objects in your

application. Double click the Create Button in Design view to generate the event handler. Create new variables to store the

three lengths from the TextBoxes; then use those values to create a new Tri angl e object.

g) Displaying the result. Use an If... ElseIf statement to determine whether the triangle is a right triangle, an equilateral

triangle or neither. Display the result in a Label .

h) Running the application. Select Debug > Start Debugging to run your application. Add various inputs until you have created

an equilateral triangle, a right triangle and a triangle that is neither right nor equilateral. Verify that the proper output is

displayed for each.

i) Closing the application. Close your running application by clicking its close box.

j) Closing the IDE. Close the Visual Basic IDE by clicking its close box.

Attachment:- Tutorial19.zip

Reference no: EM13933197

Questions Cloud

Wriite program using ms visual basic express edition ide : You must center all forms on the screen.
Conceptual framework for the research question : 1. Identify and describe the conceptual framework for the research question. 2. Review the relevant theoretical and empirical literature both for the system being studied and related systems.
Skills of people with disabilities are used to the fullest : Question: If you are running an organisation and you want to make sure that the skills of people with disabilities are used to the fullest, what would you do? You may use other organisational examples as supporting cases to illustrate your plan.
Prepare more than ogive curve with imaginary figures : Discuss the utility of the graphic method of presenting statistical data. What points should be taken into account in the construction of graphs? Prepare more than ogive curve with imaginary figures.
To create a read-only property : To create a read-only property (where the Set accessor is omitted), precede keyword Property with the keyword ReadOnl y.
Functional hierarchy diagram of the system : You are required to provide a functional hierarchy diagram of this system developed to at least 4 levels (level 1 being the top level, and level 4 being the lowest), a functional flow block diagram
What is the value to the client or customer : What is the value to the client or customer? Give an overview of all the value this project will bring to the busi ness. Why should they allocate money for the project
Basic of bachelor degree in hospitality and tourism : Only require basic of Bachelor Degree in Hospitality and Tourism. Not too further in Higher Education. This is the requirement from marks rubric Provides a great level of information plus some discussion of published literature.
Issues of access to target population : Discuss the methods you would use to carry out the research. You should cover the issues of access to your target population, the proposed sampling method, the instrument(s) to be used and the recording of data.

Reviews

Write a Review

Programming Languages Questions & Answers

  Explain about lexical analyzer

Explain about Lexical Analyzer

  Write a shell script to read students first names

Write a shell script that reads 5 students' first names, last names and grades and then it calculates the average, maximum and minimum grade.

  What is the break -even point for upgrades

What is break -even point for the upgrades? that is , what price would we require to charge for CPU (or disk -change only one) so result was the same cost per 1% increase for both?

  Develop the algorithms needed for designer robot

You have been hired as a system designer to develop the algorithms needed for a designer robot that can paint different patterns on the floor based on the commands it receives.

  Benefits of programming with objects and classes

How is it different from programming with functions alone? Write down benefits of programming with objects and classes in Web applications?

  Write down a program that will predict the size of a

write a program that will predict the size of a population of organisms. the program should ask for the starting number

  Create a package called my complete system

Author a new class within your newly created package called MySystemGui. In this class, you need to extend the JFrame class and implement the appropriate listeners so that your system will work.

  Program to report page number and offset of virtual address

Your program will report page number and offset of given virtual address with specified page size. Page sizes should be specified as power of 2 in the range 1024-16384 (inclusive).

  Program robots with varyingbehaviors

Your task is to program robots with varyingbehaviors - The MemoryRobot remembersall positions that it has previously occupied and never goes back to a position that it knows to be adead end.

  An sql query that will display all of the database fields.

An SQL database containing the fields in the current Chart of Accounts, plus a "balance" field.

  Expression evaluate to true if string variable equals string

Write an expression that evaluates to true if and only if the string variable equals the string "end". Suppose that the value of s were "friend".

  Create application which permits user to input a price

Create an application which allows a user to input a price until suiatble sentinel value is entered. Output is a price of each item on each day,one through seven.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd