

Use functions to complete this C + + program
#include <iostream>
#include <stdio.h>
using namespace std;
int main ()
{
double weight, distance;
int option, error;
cout << "Enter Weight and Distance \t";
//Input validation
do
{
error = 0;
cin >> weight >> distance;
if (cin.fail ())
{
cout << "Please enter a valid value" <<
endl;
error = 1;
cin.clear ();
cin.ignore (80, '\n');
}
}
while (error == 1);
//Conversion code
do
{
cout <<
"select option to convert 1 for SI t0 USCS 2 for UCSC
to SI and 0 to quit \n";
cin >> option;
if (option == 1)
{
distance = distance / 1.6;
weight = weight * 2.2;
cout << "converted weight and distance : weight
= " << weight <<
"pounds" << "\t distance = " << distance
<< "miles" << "\n";
}
else if (option == 2)
{
distance = distance * 1.6;
weight = weight / 2.2;
cout << "converted weight and distance : weight
= " << weight <<
"kilograms" << "\t distance = " <<
distance << "kilometerss" <<
"\n";
}
} while (option != 0);
return 0;
}
You want to write a converter program which will let user convert distance and weight from SI to ...
Write a C++ program that shows the following menu options and lets the user to convert from Metric to Imperial system: Converter Toolkit -------------------- 1. Temperature Converter 2. Distance Converter 3. Weight Converter 4. Quit If the user enters 1, the program should ask for the temperature in Celsius and convert it to Fahrenheit If the user enters 2, the program should ask for the distance in Kilometer and convert it to Mile If the user...
Write a program that will convert miles to kilometers and kilometers to miles. The user will indicate both a number (representing a distance) and a choice of whether that number is in miles to be converted to kilometers or kilometers to be converted to miles Each conversion is done with a value returning function You may use the following conversions. 1 kilometer = .621 miles 1 mile = 1.61 kilometers Sample Run: Please input Convert miles to kilometers Convert kilometers...
Write a C++ program that will convert distance measurements from miles to kilometers. Specifically, the program needs to convert 0, 10, 20, 30, 40 , 50, 60, 70, 80, and 90 miles to kilograms displaying both the number of miles and the number of kilograms on the same line. please comment on what is pre and post condition too
Create the Code using C Program: 2. Write a program to convert the time from 24-hour notation to 12-hour notation and vice-versa. Your program must be menu driven, giving the user the choice of converting the time between the two notations. Furthermore, your program must contain at least the following function: a function to convert the time from 24-hour notation to 12-hour notation, a function to convert the time from 12-hour notation to 24-hour notation, a function to display the...
C# Temp. Converter program.
Create a Celsius and Fahrenheit Temperature Converter
application. The application must have 2 Labels (each one of them
assigned only to Celsius and Fahrenheit), 2 TextBoxes (each one of
them assigned only to Celsius and Fahrenheit), only 1 Convert
Button, 1 Clear Button, and 1 Exit Button. Also, 1 Error message
label which will display the error messages.
The application should only allow the user to enter the
desired temperature just in one of the TextBoxes...
1
Write a program to convert the time from 24-hour notation to
12-hour notation and vice versa. Your program must be menu driven,
giving the user the choice of converting the time between the two
notations. Furthermore, your program must contain at least the
following functions:
a function to convert the time from 24-hour notation
to 12-hour notation,
a function to convert the time from 12-hour notation
to 24-hour notation,
a function to display the choices, function(s) to get
the...
Project 1, Program Design 1. Write a C program replace.c that asks the user to enter a three-digit integer and then replace each digit by the sum of that digit plus 6 modulus 10. If the integer entered is less than 100 or greater than 999, output an error message and abort the program. A sample input/output: Enter a three-digit number: 928 Output: 584 2. Write a C program convert.c that displays menus for converting length and calculates the result....
Write a Python program that does the following: Obtains the following input from a user: Mileage at beginning of measurement period Mileage at end of measurement period Gallons of fuel consumed Calculates and displays: Miles driven Miles per gallon Kilometers driven Liters of fuel consumed Kilometers per liter Also incorporate some selection structure logic into it. If a vehicle gets less than 15 miles per gallon, display the message: "Your vehicle has criminally low fuel efficiency." If it gets...
Write a Java program to convert octal (integer) numbers into their decimal number equivalents (exactly the opposite of what you have done in Assignment 4). Make sure that you create a new Project and Java class file for this assignment. Your file should be named “Main.java”. You can read about octal-to-decimal number conversions on wikepedia Assignment 4 is at the bottom Objective Your program should prompt the user to enter a number of no greater than 8 digits. If the...
Write a program that reads a string from the keyboard and tests whether it contains a valid time. Display the time as described below if it is valid, otherwise display a message as described below. The input date should have the format hh:mm:ss (where hh = hour, mm = minutes and ss = seconds in a 24 hour clock, for example 23:47:55). Here are the input errors (exceptions) that your program should detect and deal with: Receive the input from...