Question

plesse help! Kilometer Converter Design a modular program that asks the user to then converts that...

plesse help!

Kilometer Converter

Design a modular program that asks the user to then converts that distance to miles. The conversion formula is as follows: enter a distance in kilometers, and Miles = Kilometers x 0.6214



THANKS!
0 0
Add a comment Improve this question Transcribed image text
Answer #1

A program in Programming Language C++ which convert kilometer into miles.

#include <iostream>
using namespace std;

float kilometerToMiles(float km) //method to convert km into miles
{
float miles;
miles = km * 0.6214; //calculate miles
return miles; //return miles
}

int main()
{
float km, miles;
cout<<"Enter a distance in kilometers: ";
cin>>km; //input kilometers
miles = kilometerToMiles(km); //method calling
cout<<"The distance in Miles is: "<<miles; //prints miles
return 0;
}

INPUT:

Enter a distance in kilometers: 15   

OUTPUT:

The distance in Miles is: 9.321

Add a comment
Know the answer?
Add Answer to:
plesse help! Kilometer Converter Design a modular program that asks the user to then converts that...
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
  • Python code please!! Provide code and screenshots to both code and its output!!! Write a program...

    Python code please!! Provide code and screenshots to both code and its output!!! Write a program that prompts the user to select either Miles-to-Kilometers or Kilometers-to-Miles, then asks the user to enter the distance they wish to convert. The conversion formula is: Miles = Kilometers X 0.6214 Kilometers = Miles / 0.6214 Write two functions that each accept a distance as an argument, one that converts from Miles-to-Kilometers and another that converts from Kilometers-to-Miles The conversion MUST be done as...

  • You want to write a converter program which will let user convert distance and weight from SI to ...

    Use functions to complete this C + + program You want to write a converter program which will let user convert distance and weight from SI to the USCS system and vice versa The formulae are as follows: 1. Distance in miles- distance in kilometers x 1.60 2. Weight in kilograms weight in pounds x 2.20 The program would let user input the number that they want to convert and then choose the units to and from which they want...

  • #function to covert kilometer to miles #takes km input as an argument and return the calculation...

    #function to covert kilometer to miles #takes km input as an argument and return the calculation def kilometer_to_miles(km): return km * 0.6214 #function to covert miles to kilometer #takes miles input as an argument and return the calculation def miles_to_kilometer(miles): return miles/0.6214 #Main function to find the distance #by calling either of the two functions #prompt the user to enter his/her choice of distance conversion restart = 0 while (restart == 'y'): user_input = input ("Enter k to convert kilometer...

  • Design a modular program that asks the user to enter the monthly costs for the following...

    Design a modular program that asks the user to enter the monthly costs for the following expenses incurred from operating his or her automobile: loan payment, insurance, gas, oil, tires, and maintenance. The program should then display the total monthly cost of these expenses, the total trimester amount, the total semester amount and the total annual cost of these expenses. Submission should have: Source Code in PY format (No accepted screenshots of source code anymore) It should contain proper indentation...

  • Project 1, Program Design 1. Write a C program replace.c that asks the user to enter...

    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....

  • Use Kilometer Converter application code to write Temperature Converter application to convert degrees Fahrenheit into degrees...

    Use Kilometer Converter application code to write Temperature Converter application to convert degrees Fahrenheit into degrees Celsius ((F - 32)*5/9). It needs to be JavaFX 1 import javafx.application. Application; 2 import javafx.stage. Stage; 3 import javafx.scene. Scene; 4 import javafx.scene.layout.HBox; 5 import javafx.scene.layout. VBox; 6 import javafx.geometry.Pos; 7 import javafx.geometry.Insets; 8 import javafx.scene.control.Label; 9 import javafx.scene.control. TextField; 10 import javafx.scene.control.Button; 11 import javafx.event. EventHandler; 12 import javafx.event. ActionEvent; 13 14 ** 15 * Kilometer Converter application 16 17 18 public...

  • Write a program that will convert miles to kilometers and kilometers to miles. The user will...

    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...

  • In Visual Basics - Program 2. Mileage Write a program which allows the user to enter...

    In Visual Basics - Program 2. Mileage Write a program which allows the user to enter the distance they have traveled by car in miles and the number of gallons of gasoline they used to travel the distance. Be sure to allow for decimal places for both values. Your results should show miles per gallon and kilometers per gallon. A kilometer is 0.61 miles, and this value must be stored as a constant. Your outputs must be formatted to 2...

  • For the following Programming Challenges, use a modular approach and pseudocode to design a suitable program...

    For the following Programming Challenges, use a modular approach and pseudocode to design a suitable program to solve it. Whenever appropriate, validate the input data. Allow the user to enter a series of temperatures in degrees Celsius (C) terminated by the input of −999. For each one, find the corresponding temperature in degrees Fahrenheit (F). The conversion formula is: F = 9 * C/5 + 32

  • use this code of converting Km to miles , to create Temperature converter by using java...

    use this code of converting Km to miles , to create Temperature converter by using java FX import javafx.application.Application; import javafx.stage.Stage; import javafx.scene.Scene; import javafx.scene.layout.HBox; import javafx.scene.layout.VBox; import javafx.geometry.Pos; import javafx.geometry.Insets; import javafx.scene.control.Label; import javafx.scene.control.TextField; import javafx.scene.control.Button; import javafx.event.EventHandler; import javafx.event.ActionEvent; /** * Kilometer Converter application */ public class KiloConverter extends Application { // Fields private TextField kiloTextField; private Label resultLabel; public static void main(String[] args) { // Launch the application. launch(args); } @Override public void start(Stage primaryStage) { //...

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