Computes the area of a triangle

Assignment Help Basic Computer Science
Reference no: EM13706554

Question: The subsequent function computes the area of a triangle, but contains three errors. Find the errors and fix them.

Hint: There are no errors in the formula.

void triangle_area(double base, height)

double prod;

{

prod = base * height;

return (prod/2);

}

For your solution to Problem 1, you will need to (i) find each of the errors, and (ii) write the right function (just the function; not the complete program).

The solution must be error free and compile correctly on first attempt.

Reference no: EM13706554

Questions Cloud

Compute and display net weekly pay : You need to prepare a C++ program in which you declare variables that holds an hourly wage, a number of hours worked, and a withholding percentage.
Write a select statement that returns three columns : Write a SELECT statement that returns three columns: EmailAddress, OrderID, and the order total for each customer. To do this, you can group the result set by the EmailAddress and OrderID columns.
Implement a stock quote service as a web application : Implement a stock quote service as a web application using HTML, a java servlet, and a JSP page
Prepare a java program to create a gui : Prepare a java program to create a GUI and show the picture of the zodiac. Be sure to include comments. The comment should describe the purpose of the program and the data to be entered.
Computes the area of a triangle : The subsequent function computes the area of a triangle, but contains three errors. Find the errors and fix them.
Which detects even parity : Consider the subsequent circuit, which detects even parity. There are one output, even, and three inputs, a(2), a(l) and a(0), which are grouped as a vector or bus.
What is the cardinality of an entity : What is the cardinality of an entity - Why is it useful to consider the cardinality when designing a database?
Database design and end-user requirements : How pervasive are conflicts between database design and end-user requirements? Should the two go hand-in-hands?
Process of designing an er diagram : Does the process of designing an ER diagram ever require more than one iteration? Why or why not?

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Weighted probabilities for x86 processors

Create a procedure that receives a value N between 0 to 100. When the procedure is called, there should be a probability of N/100 that it clears the Zero flag. Write a program that asks the user to enter a probability value 0 to 100.

  Create the following for bet charts

The Banking e-Teller system allows bank customers to perform ATM transactions from their cell or smart phones. BET will allow customers to check balances, make remote photo capture check deposits, and perform balance transfers to their checking or..

  Why are they both important to game development explain

In an array of characters we saw that NULL is important in defining where the end of the string is. As we keep looking further and further into strings (both array and string) why is NULL important? With two different types of NULL, why are they both..

  Illustrate how to overload the operators

Use the class rectangletype to illustrate how to overload the operators

  As a beginning business analyst

As a beginning business analyst, you have been tasked by the project manager to develop the system requirements related to the handling of outstanding purchase orders.

  The leading business organizations

Boardman Management Group is one of the leading business organizations of today's time. They are planning to make a resort, Baderman Island Resort. The overall organization is vastly spread in number of countries. It has numerous branches in al..

  Write the code of the main part of the program

Write the code of the main part of the program so that the code only uses the operations enqueue, dequeue, size, and isEmpty. Then, show that your program works with both types of queue implementation { as a linked list and as an array.

  Write a sequential search function to search for a number

Write a sequential search function to search for a number in the unsorted array created in 1a. Count the number of comparisons and display the count at the end of the search. Test the search function by searching for the number 101.

  Show the binary results for operations

Show the binary results for the subsequent operations using a 5-bit word - 2's complement arithmetic (8-16) and (12-13);

  Base of the number system for this civilization

Many of the artifacts contain inscriptions that appear to be mathematical, and the first to be translated (with limited away-team gear) comes out as the equation

  Esign the class billtype with data members to store patients

Design the class doctorType, inherited from the class personType, with an additional data member to store doctors speciality. Add appropriate constructors and member functions to initialize, access, and manipulate the data members.

  Which item is template argument

Consider this function call: DoThis (3.85) a. Which item is template argument? b. Which template is function argument? c. Could the call be written as DoThis(3.85)?

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