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
Oksana_A [137]
3 years ago
12

Write a function DrivingCost() with input parameters drivenMiles, milesPerGallon, and dollarsPerGallon, that returns the dollar

cost to drive those miles. All items are of type double. If the function is called with 50 20.0 3.1599, the function returns 7.89975. Define that function in a program whose inputs are the car's miles/gallon and the gas dollars/gallon (both doubles). Output the gas cost for 10 miles, 50 miles, and 400 miles, by calling your DrivingCost function three times. Output each floating-point value with two digits after the decimal point, which can be achieved by executing cout << fixed << setprecision(2); once before all other cout statements.
Computers and Technology
1 answer:
stira [4]3 years ago
5 0

Answer:

// program in C++.

#include <bits/stdc++.h>

using namespace std;

// function to calculate cost

double DrivingCost(double drivenMiles, double milesPerGallon, double dollarsPerGallon){

  double cost;

  //Expression to compute cost

  cost = drivenMiles / milesPerGallon * dollarsPerGallon;

  return cost;

}

// main function

int main()

{

   double drivenMiles, milesPerGallon, dollarsPerGallon;

  //initialise the variables

  drivenMiles = 50;

  milesPerGallon = 20.0;

  dollarsPerGallon = 3.1599;

  //Call function

  double cost = DrivingCost(drivenMiles,milesPerGallon,dollarsPerGallon);

  //Display result

  cout<<"Driven miles : "<<drivenMiles<<endl;

  cout<<"Miles per Gallon : "<<milesPerGallon<<endl;

  cout<<"Dollars per Gallon : "<<dollarsPerGallon<<endl;

  cout << fixed << setprecision(2);

  cout<<"The total driving cost : "<<cost ;

  return 0;

}

Explanation:

Declare and initialize drivenMiles with 50, milesPerGallon with 20.0 and dollarsPerGallon with 3.1599.Call the function DrivingCost() with these parameters,This will calculate the cost and return the value.Print the result after getting the cost.Similarly we can calculate cost for drivenMiles equals to 10 and 400 miles also.

Output:

Driven miles : 50

Miles per Gallon : 20

Dollars per Gallon : 3.1599

The total driving cost : 7.90

You might be interested in
Which of the following is NOT a semantic reason for using header tags
Olegator [25]

Answer:

The correct option is;

C. They make text larger and bold

Explanation:

The semantic reasons for using header tags which are the benefits users derive from including header tags in content published on the web includes;

1) They give structure to the writing included in the document

2) Header tabs allow text to be broken into sections with different content in focus

3) Header tags are used to add key words to a page

4) To boost search engine optimization SEO

5) To improve visibility.

4 0
3 years ago
In which encryption strategy is the plaintext encrypted one character at a time and each encrypted character depends on that sin
Natasha_Volkova [10]

Answer:

Caesar cipher

Explanation:

In formation technology, cryptography or cryptology is a process of coding or encrypting information, using algorithms and input values in a network, where there is a present of a third party called adversaries or attackers.

There are different types of cryptography, namely, symmetric, assymmetric and hash cryptography.

Ciphers are algorithms used in cryptography to encode (encrypt) or decode (decrypt) information. An example of cipher is the Ceasar's cipher.

Ceasar cipher is a simple type of substitution cipher that encrpts plain text one character at a time and each coded character depends on the single character and a fixed distance value.

4 0
3 years ago
Andy uses a dial-up modem to connect to the Internet. He usually browses news sites, but he notices that online video takes a lo
Korvikt [17]
The answer is C. The modem does not contain enough bandwidth to handle modern video streaming.
4 0
4 years ago
Read 2 more answers
Define the following term. data, database, DBMS, database system, data- base catalog, program-data independence, user wen', DBA,
wolverine [178]

Answer:

data - Any form of value in a column of a table in a relational database.

DBMS - Short for Database management system, which is a software that can be used to create, manipulate and view databases, e.g. MS SQL Server.

database system - Same as DBMS.

database catalog - Place where the metadata of a Database, its tables, users etc. exists e.g. date created, size, number of columns etc. Also known as Data Dictionary.

program-data independence - Program-data independence refers to the capability of leaving data intact and accessible regardless of modifications to the database that contains the data.

DBA - Short for Database Administrator, person responsible for maintaining the database. Its main responsibility is to keep the data clean and safe i.e. data doesn't contain wrong or invalid data, and is safe from viruses and is backed up.

end user - Anyone who is not directly interacting with a database, but through some software like website and mobile application.

persisten object - An object of a class in a program, that interacts with the underlying database and is responsible for manipulating the database connected to.

transaction-processing system - A transaction process system is part of a software, responsible for making sure critical business transactions, like crediting or debiting money, either goes through cleanly or doesn't at all.

CRUD are the four main types of operations one can do in a database environment. It stands for creating, reading, deleting and updating.

Explanation:

4 0
3 years ago
Ports that are generally used to establish outbound connections are known as ___ ports.
aivan3 [116]

Answer:

Ephemeral

Explanation:

3 0
4 years ago
Other questions:
  • B. Find Addition of Binary Numbers: 1100112 + 11012
    11·1 answer
  • If you want to access your files anywhere from almost any connected device, you should store your files on your ________.
    9·1 answer
  • I need help making this table in html code I have some of chart done but idk where to go after the 6:30pm part
    13·1 answer
  • To get started with stock trading and to learn, many people start with this method to learn the ropes and practice with fake mon
    13·1 answer
  • When activated, an Excel object has all the features of an Excel
    8·2 answers
  • Create a class called Home that contains 4 pieces of information as instance variables: county (datatype string), street (dataty
    5·1 answer
  • Under what circumstances would a user bebetter off using a time-sharing system rather than a PC or asingle-user workstation?
    13·1 answer
  • Jimmy wrote the procedure scoreToGrade which accepts as a parameter score - a quiz score in the range 0-100. The procedure is su
    8·1 answer
  • What is not true about field properties in Access?
    13·1 answer
  • If you are going to build a custom fast PC for gaming and you need a lot of storage for big video files and videos, but you have
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!