Question




Question 1 Save 2 points Assume that the function geteMo is a part of a complete program and will return a float value which
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer:

The Syntax errors are:

  • The variavle bmi is not declared in the method.
  • Another syntax error is that we are returning bmi when the return type of the method is null.

The logical errors are listed below:

  • The return type of the method getBMI() should be of type float not void.
  • pow(2,mat) should be pow(mat, 2). This is because we need to calculate mat square but in the code given we are calculating 2 to the power mat which is logically wrong.

Corrected code:

//return type is changed
float getBMI(float kl, float mat)
{
   //declare bmi
   float bmi;
   //pow() is corrected
   bmi=kl/pow(mat,2);
   return bmi;
}

Corrected code screenshot:

//return type is changed 2 float getBMI(float kl, float mat) 39{ 4 //declare bmi 5 float bmi; 6 //pow() is corrected 7 bmi=ki

Note--

Please upvote if you like the effort.

Add a comment
Know the answer?
Add Answer to:
Question 1 Save 2 points Assume that the function geteMo is a part of a complete...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Question 1 O points Save Answer Pentaborane B SH (s) burns vigorously in O 2 to...

    Question 1 O points Save Answer Pentaborane B SH (s) burns vigorously in O 2 to give B 20 30s) and H 2001). Calculate H xn for the combustion of 5.00 mol of B SH 9. AH [B 20 3()] = -1,273.5 kJ/mol AH" fB SH 9()] - 73.2 kj/mol AH" fH 20(1 -285.8 kJ/mol For the toolbar, press ALT+F10 (PC) or ALT+FN+F10(Mac). TTT Arial .3(12pt) .T.E.E..225 Path:p Words:0

  • QUESTION 1 Historically inpatient care developed before outpatient care True False QUESTION 2 The likely impact...

    QUESTION 1 Historically inpatient care developed before outpatient care True False QUESTION 2 The likely impact of ACA on primary care is: stay the same increase decrease unknown QUESTION 3 All ambulatory care is primary care True False QUESTION 4 What is tertiary care? For the toolbar, press ALT+F10 (PC) or ALT+FN+F 10 (Mac), T T T - Font fam 3(12pt) - T- Tertiary care is highly specialized care administered to patients who have complicated medical conditions or require high...

  • Please note that Questions 15 to 17 are connected questions. Question 15: The following shows a...

    Please note that Questions 15 to 17 are connected questions. Question 15: The following shows a partial DNA sequence from the wild-type (normal) allele for the human leukemia-linked apoptotic gene.   5' ATGCGATTAATCGGTAAA 3' (non-template strand) 3' TACGCTAATTAGCCATTT 5' (template strand) Please answer the following questions: (a) If the bottom strand serves as the DNA template for transcription, what is the resulting mRNA sequence? The mRNA sequence is  5'  3'. (2 marks) 5' AUG CGA UUA AUC GGU AAA 3' ? Please enter...

  • Question 2 - Programming Exercise 1. Make a directory for this lab and change into it....

    Question 2 - Programming Exercise 1. Make a directory for this lab and change into it. 2. Copy files using the following command: cp/net/data/ftp/pub/class/115/ftp/cpp/Inheritance/Exercise.cpp Exercise.cpp Finish the program so that it compiles and runs. The instructions are contained in the C++ file. Your completed program should generate output similar to the following: TwoD default constructor This program asks for the coordinates of two points in 3D space and calculates their distance. Please enter the xyz coordinates for the first point:...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT