answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
LiRa [457]
2 years ago
10

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
Computers and Technology
1 answer:
kodGreya [7K]2 years ago
8 0

Answer:

<em>The Triangle.java file is not provided; However, the program is as follows;</em>

<em>Comments are used for explanatory purpose</em>

<em>Also see attachment for Triangle.java program file</em>

<em />

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));

 }

}

}

Download java
You might be interested in
The Spinning Jenny reduced the number of workers necessary to _______. a.remove cotton seeds from fibers b.pump water from the m
bazaltina [42]

The answer is D: Turn yarn into cloth.

During the industrial revolution, a number of new inventions in the textile industry greatly impacted this industry. However, it was the invention of the Spinning Jenny that is credited a lot. It helped move the textile industry from homes to factories and made wool spinning easier and faster. This invention, however, impacted the labor workforce. It reduced the amount of work needed to produce yarn. One worker was able to work 8 or more spools at once and rose to 120 due to technological advancements.

5 0
2 years ago
Which of the following is an advantage of inserting a page number field in your document rather than inserting each page number
Artyom0805 [142]

The advantage of inserting the page number field is that the page number field could show the current page number.

The following information should be relevant with respect to the page number:

  • The page number field & the actual page number should be formatted.
  • The page number field & the actual page number both could be inserted into the header or footer.
  • The page number field & the actual page number could be easily inserted into the document.

Therefore we can conclude that the advantage of inserting the page number field is that the page number field could show the current page number.

Learn more about the page number here: brainly.com/question/3063419

8 0
2 years ago
Steps in creating a folder
enyata [817]
Right click computer screen and press new folder?
or add paper to rings in the physical folder<span />
8 0
2 years ago
Write code which takes a user input of a String and an integer. The code should print each letter of the String the number of ti
il63 [147K]

import java.util.*;

public class myClass {

public static void main(String args[]) {

Scanner scan = new Scanner(System.in);

System.out.print("Input a String: ");

String str = scan.nextLine();

System.out.print("Input an integer: ");

int num = scan.nextInt();

for(int i=str.length()-1; i>=0; i--) {

for(int j=0; j<num; j++) {

System.out.print(str.charAt(i));

}

}

}

}

8 0
2 years ago
Moore’s Law is said to be more of a trend, rather than a representation of the actual number of transistors on a silicon chip. W
inna [77]

Answer:

Moores Law is defined to be the computer law which defines that the number of transistors on the integrated circuits will double time to time such as in an interval of 2 years. Moore's Law was coined by Intel employee, Gordon Moore.Moore's law is the observation that the number of transistors in a dense integrated circuit doubles about every two years. ... Moore's law describes a driving force of technological and social change, productivity, and economic growth.

Explanation:

Moore's Law is named after Intel cofounder Gordon Moore. He observed in 1965 that transistors were shrinking so fast that every year twice as many could fit onto a chip, and in 1975 adjusted the pace to a doubling every two years. ... Intel has suggested silicon transistors can only keep shrinking for another five years.Moore's law is the observation that the number of transistors in a dense integrated circuit doubles about every two years. ... Moore's law describes a driving force of technological and social change, productivity, and economic growth.Moore's law is the observation that the number of transistors in a dense integrated circuit doubles about every two years. ... Moore's law describes a driving force of technological and social change, productivity, and economic growth. Moore's law is an observation and projection of a historical trend.Moore's law is the observation that the number of transistors in a dense integrated circuit doubles about every two years. The observation is named after Gordon Moore, the co-founder of Fairchild Semiconductor and CEO of Intel, whose 1965 paper described a doubling every year in the number of components per integrated circuit,[2] and projected this rate of growth would continue for at least another decade.[3] In 1975,[4] looking forward to the next decade,[5] he revised the forecast to doubling every two years, a compound annual growth rate (CAGR) of 40%.[6][7][8]

The doubling period is often misquoted as 18 months because of a prediction by Moore's colleague, Intel executive David House. In 1975, House noted that Moore's revised law of doubling transistor count every 2 years in turn implied that computer chip performance would roughly double every 18 months (with no increase in power consumption).[9] Moore's law is closely related to MOSFET scaling, also known as Dennard scaling,[10] as the rapid scaling and miniaturization of silicon MOSFETs (metal-oxide-semiconductor field-effect transistors, or MOS transistors)[11][12] is the key driving force behind Moore's law.[10][13]

Moore's prediction proved accurate for several decades and has been used in the semiconductor industry to guide long-term planning and to set targets for research and development (R&D).[14] Advancements in digital electronics are strongly linked to Moore's law: quality-adjusted microprocessor prices,[15] memory capacity (RAM and flash), sensors, and even the number and size of pixels in digital cameras.[16] Digital electronics has contributed to world economic growth in the late twentieth and early twenty-first centuries.[17] Moore's law describes a driving force of technological and social change, productivity, and economic growth.[18][19][20][21]

Moore's law is an observation and projection of a historical trend. It is an empirical relationship and not a physical or natural law. Although the rate held steady from 1975 until around 2012, the rate was faster during the first decade. In general, it is not logically sound to extrapolate from the historical growth rate into the indefinite future. For example, the 2010 update to the International Technology Roadmap for Semiconductors predicted that growth would slow around 2013,[22] and in 2015, Gordon Moore foresaw that the rate of progress would reach saturation: "I see Moore's law dying here in the next decade or so."[23]

Microprocessor architects report that semiconductor advancement has slowed industry-wide since around 2010, below the pace predicted by Moore's law.[24] Brian Krzanich, the former CEO of Intel, announced, "Our cadence today is closer to two and a half years than two."[25] Intel stated in 2015 that improvements in device have slowed, starting at the 22 nm feature width around 2012, and continuing at 14 nm.[26] Krzanich cited Moore's 1975 revision as a precedent for the current deceleration, which results from technical challenges and is "a natural part of the history of Moore's law".[27][28][29] Leading semiconductor manufacturers, TSMC and Samsung Electronics, have the 10 nm and 7 nm nodes in

4 0
2 years ago
Other questions:
  • When you park on a hill, think about which way _____.
    6·2 answers
  • In a case where electrical current leakage from the circuit occurs, the GFCI would do the following:
    10·1 answer
  • Describe a situation involving making a copy of a computer program or an entertainment file of some sort for which you think it
    7·1 answer
  • What is printed by the following program provided all necessary standard header files are included? Explain each line of the out
    10·1 answer
  • Create an abstract Division class with fields for a company's division name and account number, and an abstract display() method
    14·1 answer
  • 2 Name the package that contains scanner class?​
    10·1 answer
  • Company A is setting up a network of mostly Windows machines. Which networking file system protocol would you recommend for maxi
    5·1 answer
  • There is a function we are providing in for you in this problem called square. It takes one integer and returns the square of th
    9·1 answer
  • Summary: Given integer values for red, green, and blue, subtract the gray from each value. Computers represent color by combinin
    11·1 answer
  • 2. BIOS is contained in ROM and not in RAM. Can you guess why?​
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!