Concept explainers
Body Mass Index (BMI) helps in specifying the weight category a person belongs to, depending on their body weight. BMI is estimated using the following formula:
Write a
wherever required.
Want to see the full answer?
Check out a sample textbook solutionChapter 1 Solutions
Absolute Java (6th Edition)
Additional Engineering Textbook Solutions
Problem Solving with C++ (10th Edition)
Starting Out with Java: From Control Structures through Data Structures (3rd Edition)
Digital Fundamentals (11th Edition)
Starting Out with Python (4th Edition)
Computer Science: An Overview (13th Edition) (What's New in Computer Science)
- 4. During each summer, John and Jessica grow vegetables in their backyard and buy seeds and fertilizer from a local nursery. The nursery carries different types of vegetable fertilizers in various bag sizes. When buying a particular fertilizer, they want to know the price of the fertilizer per pound and the cost of fertilizing per square foot. The following program prompts the user to enter the size of the fertilizer bag, in pounds, the cost of the bag, and the area, in square feet, that can be covered by the bag. The program should output the desired result. However, the program contains logic errors. Find and correct the logic errors so that the program works properly. // Logic errors. #include #include using namespace std; int main() { double costs double area; double bagsize; cout > bagsize; cout > cost; cout > area; cout << endl; cout << "The cost of the fertilizer per pound is: $" << bagsize / cost << endl; cout << "The cost of fertilizing per square foot is: $" << area / cost << endl; return 0; }arrow_forward(Thermodynamics) a. Design, write, compile, and run a program that determines the work,W, performed by a piston engine providing a force of 1000 N over a distance of 15 centimeters. The following formula is used to determine the work performed: W=Fd F is the force provided by the piston in Newtons. d is the distance the piston moves in meters. b. Manually check the values computed by your program. After verifying that your program is working correctly, modify it to determine the work performed by six pistons, each providing a force of 1500 N over a distance of 20 centimeters.arrow_forwardMiles to track laps One lap around a standard high-school running track is exactly 0.25 miles. Write a program that takes a number of miles as input, and outputs the number of laps. Output each floating-point value with two digits after the decimal point, which can be achieved as follows: print('%0.2f' % your_value) Ex: If the input is: 1.5 the output is: 6.00 Ex: If the input is: 2.2 the output is: 8.80 Your program must define and call the following function: def miles_to_laps(user_miles) Define the function miles_to_laps taking the variable user_milesReturn the value of dividing userMiles by 0.25In mainDeclare variable user_miles as a doubleInput user_milesAssign to num_laps the value returned from miles_to_laps passing in user_milesOutput num_laps My code to point: def miles_to_laps(user_miles):laps = user_miles * 4return(laps)user_miles = float laps = float(miles_to_laps(user_miles) if __name__ == '__main__':arrow_forward
- code MASM32 Function 1: calculate even numberInput a positive integer n and calculate the sum of even numbers between 0 and n and print the result.Function 2: check leap yearEnter a year and check if the year is a leap year and print the result. A leap year is a year that is divisible by 400 or divisible by 4 but not divisible by 100. Call 2 functions into the main program, compile and run test resultsarrow_forward###Python Program-related question. So need the answer in python expressions. COSC 1336 – Programming Fundamentals I Program 3 – Arithmetic Expressions A county collects property taxes on the assessed value of property, which is 60 percent of its actual value. For example, if a house is valued at $158,000.00 its assessed value is $94,800. This is the amount the homeowner pays tax on. If the tax rate is $2.64 for each $100.00 of assessed value, the annual property tax for this house would be$2502.72. Write a program that asks the user for the actual value of a piece of property and the current tax rate for each $100.00 of assessed value. The program should then calculate and display how much annual property tax the homeowner will be charged for his property. Run your program three times with the data below and copy and paste the outputs to afile. Create a folder named, fullname_program3. Copy your source code and the output file to the folder. Property Value: Tax Rate$100,000.00…arrow_forwardDistance Traveled Assuming there are no accidents or delays, the distance that a car travels down the interstate can be calculated with the following formula: Distance = Speed x Time A car is traveling at 70 miles per hour. Write a program that displays the following * The distance the car will travel in 6 hours * The distance the car will travel in 10 hours * The distance the car will travel in 15 hoursarrow_forward
- The inverse of height is 1 / height. The following program computes the inverse of a measurement of height and then outputs the inversed value. The code contains errors. Find and fix the errors. Ex: If the input is 0.500, then the output is: The inverse of height = 1 / 0.500 = 2.000 #include <iomanip> #include <cmath> #include <iostream> using namespace std; int main() { /* Modify the following code */ int height; int heightInverse; cin >> height; heightInverse = 1 / height; cout << "The inverse of height = 1 / " << fixed << setprecision(3) << height; cout << " = " << heightInverse << endl; return 0; }arrow_forwardThink Time Flowchart Draw a flow chart for a program that will receive the name and final exam results for all FBT0015 students; as long as the result entered by user is not more than 100 or less than 0.Then, calculate the total scores of all results. If the entered result is more than 100 or less than 0, the average willI be calculated and displayed on screen.arrow_forwardHi All, Need help with this homework question. All coding is in Python. 1.) Rectangle Area The area of a rectangle is calculated according to the following formula: Area= Width * Length Design a function that accepts a rectangle's width and length as arguments and returns the rectangle's area. Use the function in a program that prompts the user to enter the rectangle's width and length, and then displays the rectangle's area. All coding is done in Python.arrow_forward
- 1. Write the algorithm and draw the flow chart for a program that calculates and displays a person’s body mass index (BMI). The BMI is often used to determine whether a person with a sedentary lifestyle is overweight or underweight for his or her height. A person’s BMI is calculated with the following formula: BMI = weight × 703 / height2 Where weight is measured in pounds and height is measured in inches. The program should display a message indicating whether the person has optimal weight, is underweight, or is overweight. A sedentary person s weight is considered to be optimal if his or her BMI is between 18.5 and 25. If the BMI is less than 18.5, the person is considered to be underweight. If the BMI value is greater than 25, the person is considered to be overweight. 2. Draw a flowchart that shows how to evaluate the following expression, given that A = 1 and B = 3. Your answer should be either be true or false. (A + 5) ^2 − (B + 4 * A)arrow_forwardParking Charges) A parking garage charges a $2.00 minimum fee to park for up to threehours and an additional $0.50 per hour for each hour or part thereof over three hours. The maximumcharge for any given 24-hour period is $10.00. Assume that no car parks for longer than 24 hoursat a time. Write a program that will calculate and print the parking charges for each of three customers who parked their cars in this garage yesterday. You should enter the hours parked for eachcustomer. Your program should print the results in a tabular format, and should calculate and printthe total of yesterday's receipts. The program should use the function calculateCharges to determine the charge for each customer. Your outputs should appear in the following format:Car Hours Charge1 1.5 2.002 4.0 2.503 24.0 10.00TOTAL 29.5 14.50arrow_forwardThe program must calculate and display the amount to pay for tickets booked to travel from of departure to a destination. Example of how the program must work: Input: Enter the place of departure: Durban Enter the destination: Johannesburg Enter the price of one ticket: 989.45 Enter the number of tickets to be booked: 2 Output: A booking was made for 2 tickets From Durban to Johannesburg Total amount: R 1978.90 Another example: Enter the place of departure: Cape Town Enter the destination: Port Elizabeth Enter the price of one ticket: 78e.50 Enter the number of tickets to be booked: 3 A booking was made for 3 tickets From Cape Town to Port Elizabeth Total amount: R 2341.50arrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage LearningC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr