Given class Triangle (in file Triangle.java), complete main() to read and set the base and height of triangle1 and of triangle2, determine which triangle's area is larger, and output that triangle's info, making use of Triangle's relevant methods. Ex: If the input is: 3.0 4.0 4.0 5.0 where 3.0 is triangle1's base, 4.0 is triangle1's height, 4.0 is triangle2's base, and 5.0 is triangle2's height, the output is: Triangle with larger area: Base: 4.00 Height: 5.00 Area: 10.00

Answers

Answer 1

Answer:

The Triangle.java file is not provided; However, the program is as follows;

Comments are used for explanatory purpose

Also see attachment for Triangle.java program file

import java.util.*;

public class triangle

{

public static void main(String [] args)

{

 Scanner input = new Scanner(System.in);

 //Declare variables

 double base1, height1, base2, height2;

 //Prompt user for inputs

 System.out.println("Provide values for the base and height of the two triangles");

 System.out.print("Base of Triangle 1: ");

 base1 = input.nextDouble();

 System.out.print("Height of Triangle 1: ");

 height1 = input.nextDouble();

 System.out.print("Base of Triangle 2: ");

 base2 = input.nextDouble();

 System.out.print("Height of Triangle 2: ");

 height2 = input.nextDouble();

 //Compare and Print Results

 if(0.5 *base1 * height1 > 0.5 * base2 * height2)

 {

  System.out.print("Triangle with larger area: Base: "+base1+" Height: "+height1+" Area: "+(0.5 * base1 * height1));

 }

 else

 {

  System.out.print("Triangle with larger area: Base: "+base2+" Height: "+height2+" Area: "+(0.5 * base2 * height2));

 }

}

}


Related Questions

You are currently working in a mid-tier accounting firm. In an engagement meeting with a client, the management of your client is concerned that the audit tests that you perform will disrupt operations. Your client has recently implemented a data warehouse and the management suggests that you draw the data for analytical reviews and substantive testing from the data warehouse instead of the operational database. The management points out that operational data are copied weekly into the data warehouse and all data you need are contained there. Outline your response to the management’s proposal and mention any concerns you might have. (maximum 300 words)

Answers

Answer:

The answer "Only when an auditor is free to perform his responsibilities should the audit contract be accepted. There should be no stress on an investigator but no independence".

Explanation:

In the essence of the data store, huge storage of the information, that is used to collect from either a variety of sources within the same company. The DTC  is often used as an analytics capability (OLAP frameworks) because a transfer can be focussed on the data structure. It's also currently easier for organizations to end things or assessment and determine the best information with full of data from one destination.

Create a complete warehouse:  It is unlikely, however, that each one of your getting your information at that same single place seems to be the greatest flexibility for providing a database server.  

Below are various benefits of providing data storage:  

Saving time:  In the company's ease of accessing data from different sources at the data center, that ensures no time to obtain information from other sources is lost. Higher trust: Its data is automatically moved into your data center in an ordered structure, rather than being replaced by human activity, as you'll be more sure that your information is nice and clean, complete and accurate.  Growing knowledge: In the data, the warehouse designs the information so that it can be easily analyzed.  Increasing quality: it would be far easier to manage individuals who reach your data whenever an association position is integrated. Data warehouse allows security fully flexible, allowing users to access all the systems and lock all of them.  

Following are its specific approach to creating a data center, which will you need to develop the core architecture in three sections:  

The stocking(storage) algorithm,  Software and working  HR.

Storage: it's the foundation of the structure and your warehouse lives there. The inner server is the client's office 's internal device as well as the cloud is an electronic storage solution that relies on external servers.

Software: It is a valuable method of private cloud architectural design. For two classes, centralization and visual imagery are commonly isolated.  

Human resources: It is the part of data warehouse operations which is extremely important for a workable example. To keep your warehouse running, you must use new circumstances in your company.

Write a method called allDigitsOdd that returns whether every digit of a positive integer is odd. Return true if the number consists entirely of odd digits (1, 3, 5, 7, 9) and false if any of its digits are even (0, 2, 4, 6, 8). For example, the call allDigitsOdd(135319) returns true but allDigitsOdd(9145293) returns false.

Answers

Answer:

Sample output:

Enter integer 3232423

true

Enter integer 12131231

false

Explanation:

Above is the output of the program and for the solution check the screenshots attach to understand clearly the program.

Thanks

Design a program for Jones College. The current tuition is $12,000 per year, and tuition is expected to increase by 5 percent each year. Display the tuition amount for each year over the next five years (use a looping structure). Hint: You will need to use two assignment statements for calculating purposes. One will be an accumulating total assignment statement.

Answers

Answer:

current_tuition = 12000

for year in range(1, 6):

   increase_in_tuition = current_tuition * 0.05

   current_tuition += increase_in_tuition

   print("The tuition amount after " + str(year) + ".year: " + str(current_tuition))

Explanation:

*The code is in Python

Set the current tuition as 12000

Create a for loop that iterates 5 times

Inside the loop, calculate the increase in tuition. Add the increase in tuition value to the current tuition and print the current tuition.

A cookie recipe calls for the following ingredients: • 1.5 cups of sugar • 1 cup of butter • 2.75 cups of flour The recipe produces 48 cookies with this amount of ingredients. Write a program that asks the user how many cookies they want to make and then displays the number of cups of each ingredient needed for the specified number of cookies in the following format: You need 5 cups of sugar, 3 cups of butter, and 7 cups of flour. Note: Don’t worry about formatting the numbers in the output.

Answers

Answer:

This program is written using c++ programming language

Comments are used to explain difficult lines

See attachment for .cpp source files

Program starts here

#include<iostream>

using namespace std;

int main()

{

// Calculate number of ingredient that makes up 48 cookies

float num_sugar = 1.5/48;

float num_butter =1.0/48;

float num_flour = 2.75/48;

//Declare integer variable to get number of cookies from user

int n;

// Prompt user for number of cookies needed

cout<<"Enter number of cookies: ";

cin>>n;

// Calculate equivalent amount of ingredient

num_sugar *= n;

num_butter *= n;

num_flour *= n;

// Display Result

cout<<"You need "<<num_sugar<<" cups of sugar, "<<num_butter<<" cups of butter, and "<<num_flour<<" cups of flour.";

return 0;

}

//End of Program

Industrial Products is a small light-manufacturing firm that produces a variety of control systems for heavy industry. It has a network that connects its office building and warehouse that has functioned well for the last year, but over the past week, users have begun to complain that the network is slow. Clarence Hung, the network manager, did a quick check of the number of orders over the past week and saw no real change, suggesting that there has been no major increase in network traffic. What would you suggest that Clarence do next?

Answers

Answer and Explanation:

The suggestions are as follows

1. There may be a faulty configuration that leads to packet losses, those packets lost are retransmitted over and over again that may have caused network slowing down.

2. The route or direction for the transmission of packets over the network can shift, which in effect increases the time for the transmission of packets and thus leads to a slowed-down network.

3. Probability is the authentication server that would take too much time to respond.

4. There may be some applications that produce errors for certain requests and therefore fail to complete the process on time. The failures may be on the front end of the server or back end.

Upgrading the apps to new versions will solve the issue, as the upgraded software involve different fixes.

5. Users will be tested on what they're doing on their devices. Unacceptable use of the network services can also result to a network slow- down.

6. Certain bad cable connexions or poor signal strength can result in network slowing down.

Discuss whether this is a good Web site to use as a source for reliable, academically sound information on neurotransmitters. Why or why not?

Based on what you have learned about neurotransmitters in this unit through the textbook and intellipath, do you think you would recommend a friend or family member opt for this testing? Explain your response.

Answers

Answer:

The answer to this question can be described as follows:

Explanation:

No, for all of this experiment, I will not remember a family member or friend. It is because the test results and arguments presented in it were not as relevant and fun.  

After all, they should be. They will often seem vague and uninteresting to make this same testing perception boring and tedious overall. In the above line, it is explained, that why they are not is used, that's why the answer to this question is no.

If your internet were to go out, what steps would you take to troubleshoot to restore your service?

Answers

Answer:

Make sure all your wires are connected and electricity is flowing

Turn your computer off and on

Turn your modem off and on

is it only your computer that can't connect or also your phone? (if it's only your computer then something in the configurations if off)

Call internet provider is non of these work.

Explanation:

why ‘illegal contract’ is a contradiction in terms?

Answers

Answer:

An Illegal contract or agreement is a contraction in terms when a contract is a legal obligation, illegal contract is viewed as a contradiction in terms.

Explanation:

Solution

An Illegal contract is called a contradiction for the following reasons listed below:

When a contract has a term that is obligatory, it is called a legal contract.

According to the rules of terms, when a contract is not done legally, it is considered an illegal contract.

On the common law of a contract or agreement, when a court does not apply or impose in any case or otherwise for a contract, it is seen as illegal.

The data files from a computer-assisted questionnaire software program can be downloaded at the researcher's discretion; however, different formatting options, including SPSS-readable files, may not be available. Group of answer choices True False

Answers

Answer:

False.

Explanation:

When data files are sourced from a computer-assisted questionnaire software program. The data files can be downloaded at the researcher's discretion, different formatting options can be used on the data files, and SPSS (Statistical Product and Service Solutions)-readable files are also available.

For instance, the CAPI (Computer-Assisted Personal Interview), CAWI (Computer-Assisted Web Interview)  and CASI (Computer-Assisted Self Interview) software program collects data from potential targeted population in a survey. These data can be downloaded by the originator of the survey with its SPSS (Statistical Product and Service Solutions)-readable files.

Also, if the researcher wishes to edit or format the data, it is very possible to achieve.

Bell LaPadula (BLP) is a security model
a) that can ensure the confidentiality of the classified data as well as its integrity
b) that can ensure the confidentiality of the classified data but not its integrity
c) that can ensure neither the confidentiality of the classified data nor its integrity
d) that can't ensure the confidentiality of the classified data but can its integrity

Answers

Answer:

Option (b) is the correct answer to this question.

Explanation:

BLP model can ensure classified data confidentiality, but it is not integrity. The Bell-LaPadula model is about secrecy. As just that, having read information would jeopardize privacy and security at a greater position than what has been permitted. The Bell – LaPadula Model (BLP) is a finite state model being used for political and police installations to implement authentication.

Other options are incorrect because they are not related to the given scenario.  

Write a program that reads the lengths of the sides of a triangle from the user. Compute the area of the triangle using Heron's formula (below), in which s represents half of the perimeter of the triangle and a, b, and c represent the lengths of the three sides. Print rhe area to three decimal places.

Area= √ s(s-a)(s-b)(s-c)

Answers

Answer:

The java program is as follows.

import java.util.Scanner;

import java.lang.*;

public class Area

{

   //variables to hold the values

   static double a, b, c;

   static double s;

   static double area;

public static void main(String[] args) {

    //scanner class object created

    Scanner sc = new Scanner(System.in);

 System.out.print("Enter the first side: ");

 a=sc.nextInt();

 System.out.print("Enter the second side: ");

 b=sc.nextInt();

 System.out.print("Enter the third side: ");

 c=sc.nextInt();

 s=(a+b+c)/2;

 //function of Math class used

 area = Math.sqrt( s*(s-a)*(s-b)*(s-c) );

 //result displayed with 3 decimal places

 System.out.printf("The area of the triangle is %.3f", area);  

}

}

OUTPUT

Enter the first side: 1

Enter the second side: 1

Enter the third side: 1

The area of the triangle is 0.433

Explanation:

1. The variables to declare the three sides of the triangle, the semi-perimeter and the area of the triangle are declared with double datatype. All the variables are declared at class level and hence, declared with keyword, static.  

2. Inside main(), an object of the Scanner class is created.

Scanner sc = new Scanner(System.in);

3. Using the Scanner class object, user input is taken for all the three sides of the triangle.

4. Following this, the semi-perimeter is computed as shown.

s=(a+b+c)/2;

5. The area of the triangle is computed using the given formula which is implemented as shown.

area = Math.sqrt( s*(s-a)*(s-b)*(s-c) );

6. The sqrt() method of the Math class is used while computing the area of the triangle.

7. The area is displayed with three decimals. This is done using the printf() method as shown.

System.out.printf("The area of the triangle is %.3f", area);

8. The program is saved with the same name as the name of the class having the main() method.

9. The class having the main() method is always public.

Create a text file named employee.dat containing the following data: b. Write a C++ program to read the employee.dat file created in Exercise 5a and produce a duplicate copy of the file named employee.bak.

Answers

Answer:

1000 500 250 125 the output

Explanation:

write a program using integers userNum and x as input,  userNum divided by

x four times.  EX : If  the input is 2000 2 the output is 1000 500 250 125

Suppose we have a JDBC Connection object c to a database, and this database has a relation R (name, address, phone) Columns name and address are of string type, while phone is an integer. The following objects are also declare: Statement s-null; q = "SELECT address, phone FROM R" + "WHERE name = 'Bill Gates' ". ng Resultset r null; There are many methods that could be applied to the given variables. Whena method is applied to r, assume that it holds the result of query q. Then, identify a correct use of a method from the list below. oa) r s.executeQuery (q)i b) r-executeQuery(q) O) c) string a = r.ge t String (0); d) String x - r.getInt(1);

Answers

Answer:

The correct answer is option A r s.executeQuery (q) ;

Explanation:

Solution

The execute Query()  method is a method or technique derived from Statement class object. this type of method or techniques implements or executes  the SQL query and returns the table in the way of Result Set object.

The Option B, C, and the D in this case is not correct.

What will happen if registers are excluding the address register (Memory Address Register - MAR)?​

Answers

Answer: Memory address register captures and stores the memory address in CPU.

Explanation:

It stores the address of the data which is required to be sent and stored to specific location of the computer.It stores the next address of the data to be stored read or written.

If the memory address register is excluded in the system then the storage of memory will be compromised.

Computer has many functions. MAR is known to have the memory location of data that one needs to be accessed and if it is excluded, there is a compromise and one cannot get the data needed as it will be inaccessible.

What is the Memory Address Register?In a computer, the Memory Address Register (MAR) is known to be the CPU register that often stores the memory address through which one can get data to the CPU.

It is also known as the address to which data is often sent to or stored. That is, MAR has the power  to the memory location of data that one needs to be accessed.

Learn more about Memory Address Register from

https://brainly.com/question/24368373

Other Questions
In the diagram, which two angles are corresponding angles with angle 12?Angle 8 and Angle 16Angle 6 and Angle 10Angle 9 and Angle 11Angle 5 and Angle 15 You decide that you need more information on how employees feel about diversity, so you create a paper and pencil survey on employee attitudes toward diversity and ask managers to distribute it to current employees. If found to be present. What would be the most likely grounds for concern? I need help ASAP. Please right answers only PLEASE HELP ILL MAKE BRAINLIESTWhich of the following is a monomial?A.) 3/xB.) 5x^2 + 2x + 3C.) 4xD.) sqre x-1 Blossom Corporation, a manufacturer of ethnic foods, contracted in 2020 to purchase 470 pounds of a spice mixture at $2.35 per pound, delivery to be made in spring of 2021. By 12/31/20, the price per pound of the spice mixture had risen to $2.73 per pound. In 2020, Blossom should recognize:______.A. No gain or loss. B. A gain of $178.60. C. A loss of $1104.50. D. A loss of $178.60. Draw conclusions: Substances that contain carbon and are produced by living things are called organic. Examples of organic materials are sugar, blood, protein, and fat. Other materials, like water, carbon dioxide, oxygen, and ammonia, are called inorganic. Some living things, called producers, can produce the organic materials they need (like food) from inorganic matter. All other organisms are consumers; they consume organic matter since they cannot make it themselves. Do your results show you that trees are producers or consumers? its a gizmo lol after reading a poem what is the first thing you should do to begin to analyze itA.)determine the tone.B.)determine the themeC.)paraphrase the poem D.)look at the poetic devices The following were inventions during the Han dynasty except ______. a. writing c. acupuncture b. a Chinese dictionary d. tree-bark paper In the U.S. highway numbering system, north-south routes have numbers that end in _____. Sometimes on a sunny day campers start a campfire using a small mirror to light paper or dry grass. What shape of mirror would you use for this purpose? Explain your choice using reasoning. NEED HELP!Please refer to the picture for the question! Rachel is conducting a study in her cognitive psychology lab about people's ability to remember rhythms. She playeda short rhythm to 425 randomly chosen people. One minute later, she asked them to repeat it by clapping. If 121people were able to successfully reproduce the rhythm, estimate the proportion of the population (including marginof error) that would be able to successfully reproduce the rhythm. Joel weighs a basket containing 7 peaches.Each peach weigh 200g. How many kilograms does the basket weigh translate she read the newspaper in spanish Today you jogged 1/3 of a milebefore stopping to chat for amoment with your friend. Then youcontinued to jog another 1/3 of a milebefore stopping for a drink of water.How far did you jog all together?Use the number line to help you.Type your answer in the blue box. The whip-like tail of a protozoan is called a:flagellumciliaO pseudopodnone of the aboveHELPPPP !!! Which MOST FULLY identifies the central idea of this source? Solution A is a 1.00 L buffer solution that is 1.188 M in acetic acid and 1.188 M in sodium acetate. Acetic acid has a pKa of 4.74. What is the pH change of this solution upon addition of 0.1 mol of HCl? Enter your answer numerically to four decimal places. It will be a negative number. Find the value of -1/3-(-5/12) Congress must vote whether to increase the government budget so as not to shut down the government this year. The vote passed and the budget ceiling has been increased to keep the government running. This is an example of what type of policy?