Function InchesToFeet(float inchesToConvert) returns float totalFeet totalFeet = inchesToConvert / 12 // Calculate totalFeet: totalFeet = 0 Function Main() returns nothing float userInches float totalFeet userInches = Get next input totalFeet = InchesToFeet(userInches) Put userInches to output Put " inches are " to output Put totalFeet to output Put " feet." to output   The ismage uploaded is the result I am getting I am not sure what I am doing wrong

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Function InchesToFeet(float inchesToConvert) returns float totalFeet totalFeet = inchesToConvert / 12 // Calculate totalFeet: totalFeet = 0 Function Main() returns nothing float userInches float totalFeet userInches = Get next input totalFeet = InchesToFeet(userInches) Put userInches to output Put " inches are " to output Put totalFeet to output Put " feet." to output

 

The ismage uploaded is the result I am getting I am not sure what I am doing wrong

Check
Try again
X The first line of the function definition defines the return variable's type and name. A function may return one value by assigning
a return variable with the return value. Ex: MyFunction() returns integer totalCount defines a return variable called totalCount. The
statement totalCount = 100 assigns the return variable with 100. When the end of the function is reached, the value stored in
totalCount is returned.
Output differs. See highlights below.
Input
360
Your output
Expected output
Your output
Expected output
360.0 inches are 0.0 feet.
360.0 inches are 30.0 feet.
Output differs. See highlights below.
Input
45
45.0 inches are 0.0 feet.
45.0 inches are 3.75 feet.
Transcribed Image Text:Check Try again X The first line of the function definition defines the return variable's type and name. A function may return one value by assigning a return variable with the return value. Ex: MyFunction() returns integer totalCount defines a return variable called totalCount. The statement totalCount = 100 assigns the return variable with 100. When the end of the function is reached, the value stored in totalCount is returned. Output differs. See highlights below. Input 360 Your output Expected output Your output Expected output 360.0 inches are 0.0 feet. 360.0 inches are 30.0 feet. Output differs. See highlights below. Input 45 45.0 inches are 0.0 feet. 45.0 inches are 3.75 feet.
Expert Solution
Step 1: Introduction

As the programming language is not mentioned here, so I have given code in JAVA and PYTHON


Algorithm

  1. Input and Validation: The main function initiates the program by taking an input of the length in inches from the user. It ensures that this input is a float (a number that can have a decimal point).
  2. Conversion Function: The function named InchesToFeet is invoked with the user-provided inches value as an argument. This function has one job: to convert inches to feet. According to the measurement system, there are 12 inches in a foot. Therefore, the conversion involves dividing the given inches by 12.
  3. Calculation: Inside the function InchesToFeet, a variable called totalFeet is declared first to hold the result of the conversion. The inches provided are then divided by 12, and the result is stored in totalFeet.
  4. Output: The function returns the value stored in totalFeet to the main function. The main function then displays the original measurement in inches and the converted measurement in feet.

steps

Step by step

Solved in 6 steps with 2 images

Blurred answer
Knowledge Booster
Concept of Parenthesis
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education