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
Burka [1]
3 years ago
7

Driving is expensive. Write a program with a car's miles/gallon and gas dollars/gallon (both doubles) as input, and output the g

as cost for 20 miles, 75 miles, and 500 miles. Output each floating-point value with two digits after the decimal point, which can be achieved as follows: System.out.printf("%.2f", yourValue); The output ends with a newline.
Computers and Technology
2 answers:
Tatiana [17]3 years ago
4 0

Answer:

const double gasDollarPerGallon = 20 ;

float calCost( double milesPerGallon ) {

   double costPerGallon = milesPerGallon / gasDollarPerGallon;

   System.out.printf ("%.2f/n", &costPerGallon);

int main ( ) {

   scanf ("%2f", &gasDollarPerGallon) ;

   calCost( 20 );

   calCost( 75 );

   calCost( 500 );

Explanation:

The C source code above gets the user input of the gas dollar per gallon from the command prompt and divides the miles per gallon variable in the function call to get the cost of gas for the range of miles. It is also print out as a double with two places.

kiruha [24]3 years ago
4 0

Answer:

def driving_cost(driven_miles, miles_per_gallon, dollars_per_gallon):

  gallon_used = driven_miles / miles_per_gallon

  cost = gallon_used * dollars_per_gallon  

  return cost  

miles_per_gallon = float(input(""))

dollars_per_gallon = float(input(""))

cost1 = driving_cost(10, miles_per_gallon, dollars_per_gallon)

cost2 = driving_cost(50, miles_per_gallon, dollars_per_gallon)

cost3 = driving_cost(400, miles_per_gallon, dollars_per_gallon)

print("%.2f" % cost1)

print("%.2f" % cost2)

print("%.2f" % cost3)

Explanation:

You might be interested in
The capacity of a communication channel is measured in _______.
PSYCHO15rus [73]
<span>The capacity of a communication channel is measured in gb and gps.</span>
4 0
3 years ago
Read 2 more answers
Identify the type of error.<br> print "hello"<br><br> num = 5 / 0
horrorfan [7]

Answer:

Syntax error

Explanation:

This is a type of error that occurs when there is a problem with the code that makes it unable to compile and execute.

For example, making a conditional statement without using the correct parameters will result in a syntax error.

4 0
2 years ago
Read 2 more answers
You currently are IT support for Richman Investments, a brokerage firm that employs 20 brokers. Each broker has their own client
lions [1.4K]

Answer:

Use the System Restore tool to restore the affected computers back to a point before the problematic updates. To forestall issues with problematic updates, one needs to install and configure the Windows Server Update Services (WSUS) Server role.

Explanation:

Windows Update creates a restore point prior to applying any updates and this makes it easier to rollback any problematic updates using the aptly named System Restore utility.  System Restore can be launched either from within Windows or during startup depending on whether the computer can be booted  or not.

One solution to preventing this kind of problem is the implementation of a Windows Server role, the Windows Server Update Services (WSUS), which helps administrators to safely manage Windows Update for clients within its network. WSUS allows administrators to test updates for issues and approve them before they are available for deployment to clients.

4 0
3 years ago
how many bits must be flipped (i.e. changed from 0 to 1 or from 1 to 0) in order to capitalize a lowercase 'a' that’s represente
lianna [129]
Lowercase a is decimal 97 ; upper case is decimal 65

It's easier to think of them in octal, however: a = octal 141, and A is octal 101

octal to binary is easy, each digit is three bits. 
141 = 001 100 001 
101 = 001 000 001

So, how many bits are changed above? 
4 0
3 years ago
_____ is a higher-level, object-oriented application interface used to access remote database servers
makkiz [27]
RDO.

RDO uses the lower-level DAO and ODBC for direct access to databases.
7 0
1 year ago
Other questions:
  • Write a program that accepts three decimal numbers as input and outputs their sums?​
    5·1 answer
  • There are several factors that can substantially affect the consumer search process. Match the factor with an example of how the
    5·1 answer
  • The central processing unit​ (cpu) works in conjunction with​ ________ to perform processing.
    5·1 answer
  • Software that protects confidentiality by screening outgoing documents to identify and block transmission of sensitive informati
    12·1 answer
  • Consider the following C++ program in which the statements are in the incorrect order. Rearrange the statements so that itprompt
    6·1 answer
  • A project manager type a document and print it he is using
    14·1 answer
  • Which of the following is the code of acceptable behaviors users should follow while on the Internet; that is, it is the conduct
    15·1 answer
  • HELP TIMED!!!!!!!!!!!!!!!!!!!!
    5·2 answers
  • In the following shell scripting extract, the initial values of variables s, c and p are 0, 1, 1 respectively. What will be the
    6·1 answer
  • You can merge the cells using the rowspan and colspan attribute of the tag <br> true or false​
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!