Question

PLEASE USE ECLIPSE AND INCLUDE A READABLE COPY OF YOUR OUTPUT FOR THE FOLLOWING PROBLEM. IT IS VERY IMPORTANT TO USE ECLIPSE AND NOT SOMETHING ELSE TO WRITE THE REQUIRED C++ PROGRAM. THANK YOU.

Design Specifications: Write a C++ function named inches_ to centimeters (). This function accepts one variable of type float

0 0
Add a comment Improve this question Transcribed image text
Answer #1
#include<iostream>
#include<iomanip>

using namespace std;

float inches_to_centimeters(float inches) {
        return inches * 2.54;
}

int main() {
        float inchStart, inchStop;

        cout << "\tStart: ";
        cin >> inchStart;

        cout << "\tStop: ";
        cin >> inchStop;

        if(inchStop <= inchStart) {
                cout << "Parameter Error! Program terminated!" << endl;
        } else {
                cout << setw(9) << "INCHES";
                cout << setw(18) << "CENTIMETERS" << endl;
                cout << setw(9) << "======";
                cout << setw(18) << "===========" << endl;
                for(float x = inchStart; x <= inchStop; x += 0.5) {
                        cout << setprecision(2) << fixed;
                        cout << setw(9) << x;
                        cout << setw(18) << inches_to_centimeters(x);
                        cout << endl;
                }
        }
}

clang version6.8.0-lubuntuz (tags/RELEAS Start : 10 Stop: 20 23 INCHES CENTIMETERS 0 int main) { 18-88 10-50 11.06 11.50 12.0

Please upvote, as i have given the exact answer as asked in question. Still in case of any concerns in code, let me know in comments. Thanks!

Add a comment
Know the answer?
Add Answer to:
PLEASE USE ECLIPSE AND INCLUDE A READABLE COPY OF YOUR OUTPUT FOR THE FOLLOWING PROBLEM. IT...
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
  • C++ Please Follow Instructions Write a program that displays an inches to centimeters conversion table. Your...

    C++ Please Follow Instructions Write a program that displays an inches to centimeters conversion table. Your input will be the smallest number of inches and the largest number of inches to be converted. The intervals will be in 6 inch increments. One inch is equivalent to 2.54 centimeters. Include the following in your program: 1. Include an initial algorithm that outlines your steps. 2. Include a refined algorithm that details how each step will be executed. 3. Prompt the User...

  • PLEASE USE VERY BASIC REGISTERS AND CODE TO DO THE FOLLOWING Objectives: -write assembly language programs...

    PLEASE USE VERY BASIC REGISTERS AND CODE TO DO THE FOLLOWING Objectives: -write assembly language programs to:             -define a recursive procedure/function and call it.             -use syscall operations to display integers and strings on the console window             -use syscall operations to read integers from the keyboard. Assignment Description: Implement a MIPS assembly language program that defines "main", and "function1" procedures. The function1 is recursive and should be defined as: function1(n) = (2*n)+9                      if n <= 5              =...

  • Lab 6 Instructions Objectives: • Executing and experimenting with programs that handle array related topics such...

    Lab 6 Instructions Objectives: • Executing and experimenting with programs that handle array related topics such as declaration, initialization, storing, retrieving, and processing elements. • Effectively manipulating and using ArrayList objects. • Becoming familiar with the use of arrays as method arguments and how array elements are passed to and returned from the called method. • Mastering the use of various debugging tools available on the Eclipse IDU. Important: EVERY one of the following Activities MUST be in a separate...

  • Question 1 An array is NOT: A - Made up of different data types. B - Subscripted by integers. C -...

    Question 1 An array is NOT: A - Made up of different data types. B - Subscripted by integers. C - A consecutive group of memory chunks. D - None of the choices. Question 2 How many times is the body of the loop executed? int i=1; while(true) { cout << i; if(++i==5) break; } A - Forever B - 4 C - 5 D - 6 E - 0 Question 3 What is wrong with the following piece of...

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