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
artcher [175]
3 years ago
9

A car holds 16 gallons of gasoline and can travel 312 miles before refueling. Write aC++ program that calculates the number of m

iles per gallon the car gets. Display the result on the screen.
Computers and Technology
1 answer:
IgorC [24]3 years ago
6 0

Answer:

// here is code in C++.

#include <bits/stdc++.h>

using namespace std;

// main function

int main()

{

   // variables Declaration and initialization

   int no_gallon=16;

   int dis=312;

   // find the miles per gallon

   double mile_gallon=dis/double(no_gallon);

   // print the results

   cout<<"number of gallons: "<<no_gallon<<endl;

   cout<<"distance travel before refueling: "<<dis<<endl;

   cout<<"miles per gallon is: "<<mile_gallon<<endl;

return 0;

}

Explanation:

Declare and initialize the number of gallon and distance travel without refueling. Calculate the miles per gallon by dividing distance with number of gallons.Then print the results.

Output:

number of gallons: 16

distance travel before refueling: 312

miles per gallon is: 19.5

You might be interested in
Prompt the user to input an integer, a double, a character, and a string, storing each into separate variables. Then, output tho
katen-ka-za [31]

Answer:

import java.util.Scanner;

public class BasicInput {

   public static void main(String[] args) {

       //Create an object of the Scanner class

       Scanner scnr = new Scanner(System.in);

       

       //Define int and double variables

       int userInt;

       double userDouble;

       

       //Define char and string variables similarly

       char userChar;

       String userString;

       

       //Prompt the user to enter an integer

      System.out.println("Enter integer:");

       //Store the input in the integer variable

       userInt = scnr.nextInt();

       

       //Prompt the user to enter a double

        System.out.println("Enter double:");

       //Store the input in the double variable

      userDouble = scnr.nextDouble();

       

       //Prompt the user to enter a char

        System.out.println("Enter char:");

       //Store the input in the char variable

      userChar = scnr.next().charAt(0);

       

       //Prompt the user to enter a string

        System.out.println("Enter String:");

       //Store the input in the string variable

      userString = scnr.next();

       

       //Output the four values on a single line

       //separated by a space

       System.out.println(userInt + " " + userDouble + " " + userChar + " " + userString);

       

   }

   

}

Sample Output:

Enter integer:

>>12

Enter double:

>>23

Enter char:

>>s

Enter String:

>>asdasd

12 23.0 s asdasd

Explanation:

The code above has been written in Java. It contains comments explaining every part of the code. Please go through the comments.

5 0
3 years ago
In order to be compliant with the NIST publications, policies must include key security control requirements. One of these key r
lesya692 [45]

Answer:

True

Explanation:

In order to be compliant with the NIST publications, policies must include key security control requirements. One of these key requirements includes certification and accreditation, which is a process that occurs after the system is documented, controls tested, and risk assessment completed. It is required before going live with a major system. Once a system is certified and accredited, responsibility shifts to the owner to operate the system is a true statement.

8 0
3 years ago
Which of the following is an example of a federal tax? A. Social Security tax B. Sales tax C. Property tax D. Transaction tax
Nastasia [14]
Property tax should be the correct answer
6 0
3 years ago
An excel file called “student_gpa” is opened. What does the funnel next to “GPA” indicate
Ivan

Answer is A. The data has been filtered

The funnel in Excel lets you know that there is a filter in place on the columns. It is a filter icon. By default, any filtered column in Excel gets a little funnel icon on the top row as shown in the image attached. Once this funnel symbols is clicked, it gives you options to filter using several criteria.

6 0
3 years ago
Why we need each section of prologprogram?
evablogger [386]

Answer:

Prolog program are used in the artificial intelligence and the web development in a systematic manner process. As, it is also sometimes known as declarative language which basically consist of some facts and list. Prolog program are divided into the sections that are:

  • Domain sections
  • Clauses sections
  • Predicates sections
  • Goal sections

We need each section of the prolog program because all the sections introduced the systematic program and performed there particular functions so by using all these processing steps an efficient function are formed.

6 0
3 years ago
Other questions:
  • What is the danger in judging someone according to his or her social networking profile
    12·1 answer
  • Explain how the principles underlying agile methods lead to accelerated development and deployment of software.
    6·1 answer
  • Suppose a data broker correctly identifies that your grandmother is addicted to playing online hearts. From its business intelli
    8·1 answer
  • (1) Prompt the user to input an integer between 32 and 126, a float, a character, and a string, storing each into separate varia
    7·1 answer
  • Which of the following people was a member of FFA?
    7·1 answer
  • What are the four common tags used on webpages?
    11·1 answer
  • jeff has just upgraded from windows 7 to windows 10 and he is confused. He has started several universal apps but he can't figur
    11·1 answer
  • What are the four steps for planning a table?​
    10·1 answer
  • A large organization is struggling to close the gaps in skill levels that exist between its employees and those from competing c
    6·1 answer
  • What do you mean by computer ethics?​
    10·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!