1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Tatiana [17]
3 years ago
11

Write a program that calls a function to change a variable value from miles to kilometers.

Computers and Technology
1 answer:
Aneli [31]3 years ago
7 0

Answer:

#include <iostream>

using namespace std;

void miles_to_km(float &miles)//function to convert miles to kilo meters.

{

   miles=miles*1.6;

}

int main() {

   float miles;

   cout<<"Enter the miles"<<endl;

   cin>>miles;//taking input of the miles..

  miles_to_km(miles);//calling function that converts miles to km..

   cout<<"The number of km is "<<miles<<endl;//printing the km.

return 0;

}

Output:-

Enter the miles

54

The number of km is 86.4

Explanation:

I have created  a function miles_to_km of type void which has the argument miles passed by reference.In the function the variable miles is converted to kilo meters.Then in the main function the function is called with the value prompted from the user.Then printing the changed value.

You might be interested in
A hotel salesperson enters sales in a text file. Each line contains the following, separated by semicolons: the name of the clie
timama [110]

Answer:

see explaination

Explanation:

Java code

//Header file section

import java.util.Scanner;

import java.io.*;

//main class

public class SalesTestDemo

{

//main method

public static void main(String[] args) throws IOException

{

String inFile;

String line;

double total = 0;

Scanner scn = new Scanner(System.in);

//Read input file name

System.out.print("Enter input file Name: ");

inFile = scn.nextLine();

FileReader fr = new FileReader(new File(inFile));

BufferedReader br = new BufferedReader(fr);

System.out.println("Name \t\tService_Sold \tAmount \tEvent Date");

System.out.println("=====================================================");

line = br.readLine();

//Each line contains the following, separated by semicolons:

//The name of the client, the service sold

//(such as Dinner, Conference, Lodging, and so on)

while(line != null)

{

String temp[] = line.split(";");

for(int i = 0; i < temp.length; i++)

{

System.out.print(temp[i]+"\t");

if(i == 1)

System.out.print("\t");

}

//Calculate total amount for each service category

total += Double.parseDouble(temp[2]);

System.out.println();

line = br.readLine();

}

//Display total amount

System.out.println("\nTotal amount for each service category: "+total);

}

}

inputSale.txt:

Peter;Dinner;1500;30/03/2016

Bill;Conference;100.00;29/03/2016

Scott;Lodging;1200;29/03/2016

Output:

Enter input file Name: inputSale.txt

Name Service_Sold Amount Event Date

=====================================================

Peter Dinner 1500 30/03/2016

Bill Conference 100.00 29/03/2016

Scott Lodging 1200 29/03/2016

Total amount for each service category: 2800.0

3 0
3 years ago
Dante went to change the date for an appointment in his Outlook calendar. He double-clicked in the appointment and made the chan
meriva

The correct answer is that Dante did not click the Save and Close button before exiting the appointment.

When you make a change to an appointment in the Outlook calendar you need to click on Save in order to have the change saved in your calendar. If you do not do this the appointment will revert back to the original time and date when you exit the program.

3 0
3 years ago
Software is:
irakobra [83]
I think the answer is A
7 0
3 years ago
Create a class named CollegeCourse that includes the following data fields: dept (String) - holds the department (for example, E
frez [133]

Answer:

The answer to this question can be given as:

code:

class CollegeCourse  

{

String Dept;

int CourseNumber;

double Credits;

double fee;

}

Explanation:

We all know that class is a collection of data members and member functions. In the above code we use the following syntax for class declaration that can be given as:

Syntax of class declaration :

class class_name

{

data member & member function

}

In the above code firstly we declare a class that is CollegeCourse. In this class, we define a variable that name and datatype is already given in the question that is String Dept, int CourseNumber, double Credits, double fee. In the variables first variable data type is string. It is used for store string value like ('us','xxx','aaa').The second variable datatype is an integer. It is used for store integer value like (1,23,5,56). The third and fourth variable datatype is the same that is double. This data type is used to store the floating-point value.

5 0
2 years ago
Velma is graduating from Ashford at the end of next year. After she completes her final class, she will reward herself for her h
motikmotik

This question is incomplete because the options are missing; here are the options for this question:

Which of the following is the most effective way for Velma to save money each month?

A. Automatically reroute a portion of her paycheck to her savings account.

B. Manually deposit 10% of her paycheck in her savings account.

C. Pay all of her bills and then place the remaining money in her savings account.

D. Pay all of her bills and then place the remaining money in her piggy bank.

The correct answer to this question is A. Automatically reroute a portion of her paycheck to her savings account.

Explanation:

In this case, Velma needs to consistently save money for her vacation as this guarantees she will have the money for the trip. This means it is ideal every month she contributes consistently to her savings for the vacation.

This can be better be achieved by automatically rerouting a part of her paycheck for this purpose (Option A) because in this way, every month the money for the vacations will increase and the amount of money will be consistent, which means Velma will know beforehand the money she will have for the vacation. Moreover, options such as using a piggy bank or paying the bills and using the rest for her savings, do not guarantee she will contribute to the savings every month, or she will have the money she needs at the end.

5 0
3 years ago
Other questions:
  • Which Access database object asks a question about the data stored in a database and displays specific fields and records that a
    15·1 answer
  • Ryan wants to ensure that all the words in this document are evenly spaced so that they look neat and readable . Which option in
    12·1 answer
  • If a computer is capable only of manipulating and storing integers, what di themselves? How are these difficulties overcome
    13·1 answer
  • With a presentation open, you can hover your mouse pointer over a design theme on the Design tab, and PowerPoint will display th
    14·1 answer
  • What is the role of science and technology in achieving human’s ultimate goal or the good life?
    8·2 answers
  • What is another name for a numbered list
    6·1 answer
  • What are the fundamental activities that are common to all software processes?
    9·1 answer
  • Do you trust machine learning application?
    10·1 answer
  • 1. Name the three kinds of Eraser in Photoshop. <br>​
    8·2 answers
  • What are some qualities of a good game critic? What are some qualities of a bad game critic?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!