Design a class named triangle to represent a triangle
Course:- JAVA Programming
Reference No.:- EM131599417

Assignment Help
Expertsmind Rated 4.9 / 5 based on 47215 reviews.
Review Site
Assignment Help >> JAVA Programming

1 Classes and Objects
Build the specified Classes.

Triangle Class
Design a class named Triangle to represent a Triangle. The class should contain:

- Three double data fields named S1, S2 , and S3 that specify the three sides of the triangle.
- A static data field which counts the number of triangles created.
- A constructor which creates the triangle.
- The accessor and mutator methods for all data fields.
- A getArea method.
- A getPerimeter method.
- A getHeight method.
- A isEquilateral method.

Stock Class
Design a class named Stock to represent a trading equity. The class should contain:
- A String data field named symbol which contains the Stock's 3-letter symbol.
- A String data field named name which contains the name of the company associ- ated with the Stock.
- A double data field named previous which contains the Stock's previous closing price.
- A double data field named current which contains the Stock's current price.
- A constructor which creates the Stock utilizing the symbol and name only.
- The accessor and mutator methods for all data fields.
- A method that returns the percent of change from the previous price and the current price.

Put your comment

Ask Question & Get Answers from Experts
Browse some more (JAVA Programming) Materials
Write the definition of a method named copy receives a reference to a Scanner object associated with a stream of input. The method reads all the Strings remaining to be read
Write a Java program to fill an array of integers with 1000 randomly generated integers and sorts these numbers using selection sort. Then the program asks the user to choos
Write a program that establishes two savings accounts with saver1 having account number 10002 with an initial balance of $2,000, and saver2 having account 10003 with an init
Specify, design, and implement a class that can be one player in a game of tic-toc-toe. The constructor should be specify whether the object is to be the first player (X's)
This exercise explains you the process of testing and enhancing Line Item application. Open LineItemApp, Validator, Product, LineItem, and ProductDB classes that are in the c
We can compare Smalltalk interfaces to classes that use protocols, which are lists of operation names (selectors). When a selector allows parameters, as in at: put: , the se
Write a JAVA program that reads from the standard input stream (System.in) the order of cards in a deck and outputs who will win as well as the number of rounds played. It i
Write the complete code for a public Java class called Change Machine that can hold nickels, dimes and quarters. Include a private instance variable to hold each type of coi