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
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
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
Expert Solution
Step 1: Introduction
As the programming language is not mentioned here, so I have given code in JAVA and PYTHON
Algorithm
- 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).
- 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.
- 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.
- 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.
Step by step
Solved in 6 steps with 2 images
Knowledge Booster
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.Recommended textbooks for you
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)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
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)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education