Question

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 for the range of your table. For example, prompt the User for the beginning value of the range and the ending value of the range. If the User enters 1inch for the beginning value and 36 inches for the ending value then your chart will look something like this:

                    Conversion Chart

      Inches         Centimeters
      ******         ***********
         1                 2.54
         7                17.78
        13                33.02
        19                48.26
        25                63.50
        31                78.74

4. Use a conversion formula to calculate the centimeter equivalents where 1 inch is equal to 2.54 centimeters.
5. Use an outer Do While Loop that will ask the User if they wish to run the program again.
6. Use an inner For Loop structure that will:
          a. Initialize the For Loop counter to the beginning value entered by the User
          b. Update the counter by incrementing it by six
          c. Test the counter by comparing it to the ending value entered by the User
          d. The body of the For Loop will use the value of the counter as the inches to convert to centimeters
7. Print out each line of the chart with each loop cycle.
8. Print the table using formatting techniques such as set precision and set width.
9. Include the code to pause the output screen.
10. Include the following error checking:

  1. Do not let the User enter a largest number of inches that is more than 36 inches greater than the smallest number of inches.
    1. For example, if the User enters a 15 for the beginning number of inches then this will be the smallest number of inches on your chart.
    2. This means that the ending value for the chart (or the largest number of inches allowed) can be up to, but not greater than 51 inches.
  2. The ending value must be at least 6 inches greater than the beginning number of inches (since that's our increment size).
  3. The ending value cannot be less than the beginning value.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

`Hey,

Note: Brother in case of any queries, just comment in box I would be very happy to assist all your queries

#include <iostream>

using namespace std;

int main()
{
int start, end;
int ch=1;

do{
cout<<"Enter starting and ending range";
cin>>start;
cin>>end;
if(end<start || end-start<6 || end-start>36)
{
cout<<"Invalid range\n";
continue;
}
cout<<"Inches\tCentimeters\n";
cout<<"******\t***********\n";

for(int i=start;i<=end;i=i+6){
cout<<i<<"\t"<<i*2.54<<endl;
}
cout<<"Do you want to continue -1 to quit";
cin>>ch;
}while(ch!=-1);

return 0;
}

Select Ftestimain.exe Enter starting and ending range1 31 Inches Centimeters 2.54 17.78 33.02 48.26 63.5 78.74 13 19 25 Do yo

Kindly revert for any queries

Thanks.

Add a comment
Know the answer?
Add Answer to:
C++ Please Follow Instructions Write a program that displays an inches to centimeters conversion table. Your...
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
  • Write program in C++ (25 points) Wr largest number of centimeters in the table are input...

    Write program in C++ (25 points) Wr largest number of centimeters in the table are input values. Your table should give conversions in 10-centimeter intervals. One inch equals 2.54 cm. 2. ite a program to display a centimeter-to-inches conversion table. The smallest and Please insert the minimum value to convert to inches >>5 Please insert the maximum value to conver to inches >6e Centimeters Inches 15 25 35 45 1.9685 .99551 9.84252 13.7795 17.7165 21.6535 23.622 60

  • PLEASE USE ECLIPSE AND INCLUDE A READABLE COPY OF YOUR OUTPUT FOR THE FOLLOWING PROBLEM. IT...

    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 that represents the value of inches, and returns one variable of type float that represents the equivalent number of centimeters. Use the relationship that 1 inch 2.54...

  • Write a single C++ program that performs the following conversion (The modulus divide will help you...

    Write a single C++ program that performs the following conversion (The modulus divide will help you get the remainder as shown in class) 39 / 12 = 3 and 39 % 12 = 3, so 3 feet 3 inch(es) Height conversion 1 meter = 39 inches 12 inches = 1 foot Ask/Prompt the user to enter in the height in meters, convert and output the result in feet and inches Example 1 meters as input should produce 3 feet (foot)...

  • c++ Write a program that prompts the user to enter a length in feet and then...

    c++ Write a program that prompts the user to enter a length in feet and then enter a length in inches and outputs the equivalent length in centimeters. If the user enters a negative number or a non-digit number, throw and handle an appropriate exception and prompt the user to enter another set of numbers. Your error message should read A non positive number is entered and allow the user to try again.

  • Part A) Write a C++ program that calculates the area under a curve. Here is the...

    Part A) Write a C++ program that calculates the area under a curve. Here is the equation: f(x) = x^2 +1.5x +4 You must prompt the user for the beginning and the ending x values. You are to assume, but not check, that the user will put in whole positive numbers. The units are inches. The program input/output should look something like this: This program calculates the area under a curve between two points on the x axis. The equation...

  • In C language using printf and scanf statements: Write a program to display a histogram based...

    In C language using printf and scanf statements: Write a program to display a histogram based on a number entered by the user. A histogram is a graphical representation of a number (in our case, using the asterisk character). On the same line after displaying the histogram, display the number. The entire program will repeat until the user enters zero or a negative number. Before the program ends, display "Bye...". The program will ask the user to enter a non-zero...

  • Write a C++ program using "for" loop to allow user to guess a certain number say...

    Write a C++ program using "for" loop to allow user to guess a certain number say 55. The loop will end after 5 guesses or if he guesses the right number, which ever comes first. If user enters a number greater than 55, your program should print "You entered a bigger number". If user enters a number smaller than 55, your program should print "You entered a smaller number". If user enters 55 in less than 5 attempt, your program...

  • In C please! Thank you! Write a program that finds the smallest (min), largest (max), and...

    In C please! Thank you! Write a program that finds the smallest (min), largest (max), and average (mean) of N values entered by the user. Your program should begin by prompting the user for N, the number of values to be entered. Then the program should accept that number of values, determining the min, max, and mean. Then it should display those values. This is an extension of a previous lab. First, get it working for N values. Then, extend...

  • Help please, write code in c++. The assignment is about making a hangman game. Instructions: This...

    Help please, write code in c++. The assignment is about making a hangman game. Instructions: This program is part 1 of a larger program. Eventually, it will be a complete Hangman game. For this part, the program will Prompt the user for a game number, Read a specific word from a file, Loop through and display each stage of the hangman character I recommend using a counter while loop and letting the counter be the number of wrong guesses. This...

  • Write a menu based program implementing the following functions: (0) Write a function called displayMenu that...

    Write a menu based program implementing the following functions: (0) Write a function called displayMenu that does not take any parameters, but returns an integer representing your user's menu choice. Your program's main function should only comprise of the following: a do/while loop with the displayMenu function call inside the loop body switch/case, or if/else if/ ... for handling the calls of the functions based on the menu choice selected in displayMenu. the do/while loop should always continue as long...

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