(the triangle class) design a class named triangle that extends geometricobject. the class contains:

Answers

Answer 1

A class named Triangle has to be designed that extends the class GeometricObject.

The Triangle class can be designed as follows:

class Triangle extends GeometricObject {

// Variables that define the triangle's characteristics

double side1, side2, side3;

// Constructors

public Triangle(double side1, double side2, double side3) {

this.side1 = side1;

this.side2 = side2;

this.side3 = side3;

}

// Getters and Setters

public double getSide1() {

return side1;

}

public double getSide2() {

return side2;

}

public double getSide3() {

return side3;

}

public void setSide1(double side1) {

this.side1 = side1;

}

public void setSide2(double side2) {

this.side2 = side2;

}

public void setSide3(double side3) {

this.side3 = side3;

}

// Methods to calculate the perimeter and area of a triangle

public double getPerimeter() {

return side1 + side2 + side3;

}

public double getArea() {

double s = (side1 + side2 + side3) / 2;

return Math.sqrt(s * (s - side1) * (s - side2) * (s - side3));

}

}

Following attributes need to be present in the class Triangle: An instance variable named side1. Its visibility should be private. An instance variable named side2. Its visibility should be private. An instance variable named side3. Its visibility should be private. A constructor with side1, side2, and side3 as parameters. A method named get Area() that returns the area of the triangle. A method named get Perimeter() that returns the perimeter of the triangle. A method named __str__() that returns the string representation of the triangle.

Learn more about Instance variable here:

https://brainly.com/question/28265939

#SPJ11


Related Questions

Which of the following statements will assign the address of the variable int myInt to the pointer int* myPtr?
a.int* myPtr = *myInt;
b.int* myPtr = myInt;
c.int* myPtr = &myInt;
d.int& myPtr = &myInt

Answers

Option C: int* myPtr = &myInt; is the following statement used to assign the address of the variable int myInt to the pointer int* myPtr.

What are pointers and addresses?

In C++, pointers are variables that store the memory address of another variable. A pointer is essentially an address. It points to a memory address, indicating where a variable is stored in memory. A pointer should be declared as the data type of the variable it points to, followed by an asterisk.
For example, if a pointer points to an int, it should be declared as int*. A memory address is a unique identifier for a specific memory location. It is a reference point for a particular byte of memory. Each byte in memory has a distinct memory address.

How to assign the address of a variable to a pointer?

To assign the address of a variable to a pointer, use the address-of operator & followed by the variable name. For example, to assign the address of the variable int myInt to the pointer int* myPtr, use the following statement: int* myPtr = &myInt.

Therefore, option C, int* myPtr = &myInt, is the correct answer.

Learn more about pointers in C++:

https://brainly.com/question/20553711

#SPJ11

you are currently learning about networking devices and have just learned about mac addresses. you look up your device's mac address, and it comes back as 00-b0-d0-06-bc-ac. which portion of this mac address can tell you who the manufacturer is?

Answers

In a MAC (Media Access Control) address, the first 3 octets (6 hexadecimal digits) represent the Organizationally Unique Identifier (OUI), which can be used to identify the manufacturer or vendor of the network device.

In the given MAC address 00-b0-d0-06-bc-ac, the OUI is "00-b0-d0", which is assigned to Intel Corporation. This means that the network device was manufactured by Intel, or at least its network interface was produced by Intel. The remaining 3 octets in the MAC address (06-bc-ac) represent the device's unique identifier within that manufacturer's product line.

An exclusive identification code given to a network interface controller to be used as a network address in communications inside a network segment is called a media access control address. Ethernet, Wi-Fi, and Bluetooth are just a few of the IEEE 802 networking technologies that frequently employ this application.

Learn more about MAC address here brainly.com/question/27960072

#SPJ4

if the stack has room enough for 4 elements, can the program possibly handle an expression of 10 characters?

Answers

In this scenario, the stack has a maximum capacity of 4 elements, which means that it can only hold 4 values at any given time.

However, an expression with 10 characters would require more than 4 elements to be evaluated, which means that the stack would not be able to handle the expression.

In programming, a stack is a data structure that allows for the storage and retrieval of data in a specific order. A stack typically has a fixed size or maximum capacity, and it can only hold a certain number of elements at a time.

Learn more about programming:

https://brainly.com/question/26134656

#SPJ11

what solution puts the stolen vehicles database in 3nf by breaking up this one big table into several tables?

Answers

To convert the stolen vehicles database into 3NF (Third Normal Form), the big table should be broken down into several smaller tables that contain the necessary information.

The process involves the following steps:
1. Identify the columns that contain the same data in multiple records, and create a new table for each of these columns.
2. Make sure that each table contains a primary key that uniquely identifies a record, as well as other attributes which together form a composite key.
3. Define relationships between tables, either one-to-one or one-to-many.
4. Make sure that each table contains only the information that is necessary for it, and that all other data is moved to other tables.
5. Check for anomalies such as insertion, update, and deletion, and take care of them by creating more tables or modifying the existing ones.

By following these steps, the big table can be broken down into several smaller tables and the stolen vehicles database can be converted into 3NF.

You can learn more about 3NF at: brainly.com/question/13967439

#SPJ11

Even when a good database blueprint is available, an applications programmer's view of the data should match that of the manager and the end user.a. Trueb. False

Answers

The statement "Even when a good database blueprint is available, an applications programmer's view of the data should match that of the manager and the end user" is True.

A database is a structured set of data kept in a computer that is arranged so that it can be quickly retrieved, updated, and managed. A database's key feature is that it organizes data into tables that are related in some way. Information in a database is organized so that it is simple to access, control, and update.

The relational database is the most prevalent type of database. A data model is a graphical or symbolic description of data structures and connections used to define data architecture, manipulate data, or enforce data integrity rules. A data model's aim is to standardize the design of data in such a way that communication between different people and applications is seamless. A database blueprint is a model of a database that is used to plan and design a database structure. Then, the data model is designed to meet those requirements.

Learn more about database here:

brainly.com/question/518894

#SPJ11

Other Questions
in the book kindred by octavia bulter how do dana and kevin experience their time in the past differently? for, example, when they witness a group of slave children acting out the scene of a slave auction, how do each of them react? what does this reveal about their characters? the negative affective states commonly associated with reactive aggression are: group of answer choices .. Sasha Abbott earns $62,550.00 in taxable income each year. The tax rate is 3.6%, and she takes zero deductions. How much tax does her employer withhold each year? A $2,380.50 B $2,251.80 C $2,500.40 D $1,823.20 which of the following are functions of money? multiple select question. hedge against inflation store of value unit of account medium of exchange applying Peruvian guano," Charles Bartlett, 1860The view expressed in Source 1 shows what feature of economicimperialism by the United States?support of foreign leaders who show favoritism to the United States' economic intereststhe United States expanding its territorial possessions to secure commodities for thedomestic marketcreating tariffs to discourage foreign commodities and promote domestic producersthe structuring of trade policy in order to gain advantage for American companies PLSSSS HELP IF YOU TURLY KNOW THISSS 4 ways wich a good self awareness can decrease the likelihood of learners turning to discriminating behaviour What is a Theory Y manager likely to do according to Douglas McGregor's theory? La creacin de los hombres segn el popol vuh y qu pas con cada uno de ellos What is one or more printed or electronic pages of information issued to generate publicity or shed light on a subject of interest. if one flag pole is y feet tall and casts a shadow x feet long, then how tall is another nearby flag pole that casts a shadow p feet long at the same time of day? true or false: today there are more young children in child care in the united states than at any other time in history. 1. some of the age-related changes in the articular cartilage that contribute to osteoarthritis include for durkheim, people who performed similar tasks had in common the way they looked at life, which he called mechanical solidarity. group of answer choices true false A student wants to investigate the chemical changes that a piece of wood undergoes when it is burned. He believes wood that burns for 15 minutes will weigh less than unburned wood. Design a laboratory experiment that would allow the student to test his predictions, using appropriate equipment and technology. Be sure to consider safety requirements in your answer. despite having a lower global warming potential and a shorter residence time in earth's atmosphere, co2 is the most important radiative forcing behind global warming because - Interpret the data in the circle graph. If 560 books were sold at the book fair, find the number of the books that were mystery books.If 560 books were sold at the book fair,(Type a whole number.)of the books were mystery books.Circle graphFantasy 8%ScienceFiction12%Comic 15%Other 5%Mystery 20%-Fictic which of the following cells or substances particpates in non-specific immune defenses? natural killer cells antibodies cytotoxic t cells none of the above (a) one pair of vertical angles(b) one pair of angles that form a linear pair(c) one pair of angles that are supplementary What is the definition of a parable? Describe some of the main themes taught in the parables of Christianity.