Write a program with a car's miles/gallon and gas dollars/gallon (both floats) as input, and output the gas cost for 10 miles, 50 miles, and 400 miles. Ex: If the input is 20.0 3.1599, the output is: 1.57995 7.89975 63.198 Note: Small expression differences can yield small floating-point output differences due to computer rounding. Ex: (a + b)/3.0 is the same as a/3.0 + b/3.0 but output may differ slightly. Because our system tests programs by comparing output, please obey the following when writing your expression for this problem. First use the dollars/gallon and miles/gallon values to calculate the dollars/mile. Then use the dollars/mile value to determine the cost per 10, 50, and 400 miles. Note: Real per-mile cost would also include maintenance and depreciation.

Answers

Answer 1

Answer:

The Following are the code to this question:

def cost(miles, milesPerGallon, dollarsPerGallon):##defining a method cost that accepts three parameter

   return miles / milesPerGallon * dollarsPerGallon# calculate cost and return it value  

milesPerGallon = float(input('Enter miles/Gallon value: '))#defining variable milesPerGallon for user input  

dollarsPerGallon = float(input('Enter dollars/ Gallon value: '))#defining variable dollarsPerGallon for user input

print('{:.5f}'.format(cost(10, milesPerGallon, dollarsPerGallon)))#call method and print its value

print('{:.5f}'.format(cost(50, milesPerGallon, dollarsPerGallon)))#call method and print its value

print('{:.3f}'.format(cost(400, milesPerGallon, dollarsPerGallon)))#call method and print its value

Output:

Enter miles/Gallon value: 20.0

Enter dollars/ Gallon value: 3.1599

1.57995

7.89975

63.198

Explanation:

In the above-given code, a method "cost" is defined, that accepts three value "miles, milesPerGallon, and dollarsPerGallon" in its parameter, and use the return keyword for calculating and return its value.

In the next step, two variable "milesPerGallon, and dollarsPerGallon" is declared, that use the input method with float keyword for input floating-point value.

After input value, it uses a print method with different miles values, which are "10,50, and 400", and input value to pass in cost method to call and print its return value.


Related Questions

Java
Summary: Given integer values for red, green, and blue, subtract the gray from each value.
Computers represent color by combining the sub-colors red, green, and blue (rgb). Each sub-color's value can range from 0 to 255. Thus (255, 0, 0) is bright red, (130, 0, 130) is a medium purple, (0, 0, 0) is black, (255, 255, 255) is white, and (40, 40, 40) is a dark gray. (130, 50, 130) is a faded purple, due to the (50, 50, 50) gray part. (In other words, equal amounts of red, green, blue yield gray).
Given values for red, green, and blue, remove the gray part.
Ex: If the input is:
130 50 130
the output is:
80 0 80
Find the smallest value, and then subtract it from all three values, thus removing the gray
1 import java.util.Scanner;
2
3 public class LabProgram
4 public static void main(String[] args) {
5 /* Type your code here. */
6
7
8

Answers

Answer:

import java.util.Scanner;

public class LabProgram{

    public static void main(String []args){

       Scanner input = new Scanner(System.in);

       int red,blue,green,smallest;

       System.out.print("Enter three numbers between 0 and 255 (inclusive): ");

       red =input.nextInt();

       green =input.nextInt();

       blue =input.nextInt();

       

       if(red <= blue && red <= green){

       smallest = red;

       }

       else if(green <= red && green <= blue){

           smallest = green;

       }

       else{

            smallest = blue;

       }

       System.out.print((red - smallest)+" "+(green - smallest)+" "+(blue - smallest));

}

}

Explanation:

This line declares necessary variables

int red,blue,green,smallest;

This line prompts user for input of 3 numbers

System.out.print("Enter three numbers between 0 and 255 (inclusive): ");

The next three lines gets user inputs

       red =input.nextInt();

       green =input.nextInt();

       blue =input.nextInt();

The following iteration checks for the smallest for red, green, blue

       if(red <= blue && red <= green){

       smallest = red;

       }

       else if(green <= red && green <= blue){

           smallest = green;

       }

       else{

            smallest = blue;

       }

This line prints the required output

       System.out.print((red - smallest)+" "+(green - smallest)+" "+(blue - smallest));

An example of an access control is a: Multiple Choice Check digit. Password. Test facility. Read only memory.

Answers

Answer:

B. Password

Explanation:

An access control can be defined as a security technique use for determining whether an individual has the minimum requirements or credentials to access or view resources on a computer by ensuring that they are who they claim to be.

Simply stated, access control is the process of verifying the identity of an individual or electronic device. Authentication work based on the principle (framework) of matching an incoming request from a user or electronic device to a set of uniquely defined credentials.

Basically, authentication is like an access control, ensures a user is truly who he or she claims to be, as well as confirm that an electronic device is valid through the process of verification

An example of an access control is a password because it is typically a basic and fundamental front-line defense mechanism against an unauthorized use of data or cyber attacks from hackers.

Write a Python program that verifies the formula with the help of the Python Math module. Note that the trigonometric functions in the module act on the angles in radians. Your program should perform the following steps 3 times:_____.
1. Pick a random number between 0 and 180 degrees representing an angle in degrees, say Dangle
2. Convert the angle from degrees to radians, say Rangle
3. Use the Math module to find and print the values of sin(Rangle) and cos(Rangle), and
4. Compute and print the value of the above expression: sin^2(Rangle) + cos^2(Rangle).
You can then visually verify if the result printed is 1 (or close to it).
Hint: angle_in_radians = (angle_in_degrees * Pi)/180

Answers

Answer:

Written in Python

import math

import random

Dangle = random.randint(0,181)

pi = 22/7

Rangle = Dangle * pi/180

Rsin = math.sin(Rangle)

Rcos = math.cos(Rangle)

Result = Rsin**2 + Rcos**2

print("Result = "+str(Result))

Explanation:

The next two lines import math and random library respectively

import math

import random

This line generates a random integer between 0 and 180

Dangle = random.randint(0,181)

This line initializes pi to 22/7

pi = 22/7

This line converts angle to radians

Rangle = Dangle * pi/180

The next two lines calculate the sin and cosine of the angle in radians

Rsin = math.sin(Rangle)

Rcos = math.cos(Rangle)

This line implements sin^2 theta + cos^2 theta

Result = Rsin**2 + Rcos**2

This line prints the required Result

print("Result = "+str(Result))

what are the steps to troubleshoot a frozen computer ​

Answers

You could hold the power button down 5-10 seconds.

Write a command that will list the names of all executable files in the working directory, sorted by file size.

Answers

Answer:

The answer is "ls command".

Explanation:

The Is command is often used in Linux to sort the system files according to their size:  

#ls – F | grep ‘*$’ -s

And the other regulation they can use is  

#ls -Fla | grep ‘^\S*x\S*’

Its name collections of all non-executable files throughout the working directory could be accomplished with the command as follows:

find ! -term+|||-type s-t |find ! - term + ||| - type f-tr

What is the difference in between data science and data analytics?​

Answers

Answer:

Data analytics focuses more on viewing the historical data in context while data sciene focuses more on machine.

Explanation:

Data analytics is more specific and concentrated than data science.

How do the following technologies help you on your quest to become a digital citizen

Answers

Answer:

kiosks

Explanation:

It is generally believed that a digital citizen refers to a person who can skillfully utilize information technology such as accessing the internet using computers, or via tablets and mobile phones, etc.

Kiosks (digital kiosks) are often used to market brands and products to consumers instead of having in-person interaction. Interestingly, since almost everyone today goes shopping, consumers who may have held back from using digital services are now introduced to a new way of shopping, thus they become digital citizens sooner or later.

Write a program that will print out statistics for eight coin tosses. The user will input either an "h" for heads or a "t" for tails for the eight tosses. The program will then print out the total number and percentages of heads and tails. Use the increment operator to increment the number of tosses as each toss is input. For example, a possible sample dialog might be: For each coin toss enter either ‘h’ for heads or ‘t’ for tails. First toss: h Second toss: t Third toss: t Fourth toss: h Fifth toss: t Sixth toss: h Seventh toss: t Eighth toss: t Number of heads: 3 Number of tails: 5 Percent heads: 37.5 Percent tails: 62.5

Answers

Answer:

Written in Python

head = 0

tail = 0

for i in range(1,9):

     print("Toss "+str(i)+": ")

     toss = input()

     if(toss == 'h'):

           head = head + 1

     else:

           tail = tail + 1

print("Number of head: "+str(head))

print("Number of tail: "+str(tail))

print("Percent head: "+str(head * 100/8))

print("Percent tail: "+str(tail * 100/8))

Explanation:

The next two lines initialize head and tail to 0, respectively

head = 0

tail = 0

The following is an iteration for 1 to 8

for i in range(1,9):

     print("Toss "+str(i)+": ")

     toss = input()  This line gets user input

     if(toss == 'h'):  This line checks if input is h

           head = head + 1

     else:  This line checks otherwise

           tail = tail + 1

The next two lines print the number of heads and tails respectively

print("Number of head: "+str(head))

print("Number of tail: "+str(tail))

The next two lines print the percentage of heads and tails respectively

print("Percent head: "+str(head * 100/8))

print("Percent tail: "+str(tail * 100/8))

Could we represent every possible number with flippy do pro ?

Answers

Answer:

better with pro dud

Explanation:

.....helps??...

Where can audiovisual technology and materials be found? (Select all that apply.)



in schools

in the family home

in businesses

on the Internet

Answers

Answer:

school

family home

business

internet isnt safe

Explanation:

Answer:

Its all of the above

A: on the internet

B: in schools

C: In businesses

D: in the family home

Explanation:

EDG2021

(I found the answer in my notes, and it is all of them)

_____ is a set of processes many companies use to evaluate and improve their overall operations on an ongoing basis. Usability testing Continuous Improvement Analytics System implementation

Answers

Answer:

Continuous Improvement

Explanation:

Continuous Improvement is a set of processes many companies use to evaluate and improve their overall operations on an ongoing basis. Usability testing Continuous Improvement Analytics System implementation.

What is Continuous Improvement?

W. Edwards Deming used the phrase "continuous improvement" to refer to general processes of improvement and to embrace "discontinuous" improvements, or many diverse ways addressing various topics.

A subset of continuous improvement, with a more narrow focus on linear, incremental change inside an already-existing process, is continuous improvement.

Some practitioners also believe that statistical process control techniques are more closely related to continuous improvement. Constant improvement, often known as continuous improvement, is the continued enhancement of goods, services, or procedures through both small-scale and significant advancements.

Therefore, Continuous Improvement is a set of processes many companies use to evaluate and improve their overall operations on an ongoing basis. Usability testing Continuous Improvement Analytics System implementation.

To learn more about  Continuous Improvement, refer to the link:

https://brainly.com/question/15443538?

#SPJ3

What lets the computer's hardware and software work together?

Answers

Answer:

Essentially, computer software controls computer hardware. These two components are complementary and cannot act independently of one another. In order for a computer to effectively manipulate data and produce useful output, its hardware and software must work together.

Explanation:

Hope you understand it :)

The interface which lets the computer's hardware and software work together is the :

Operating System

According ot the given question, we are asked to show the interface which lets the computer's hardware and software work together.

As a result of this, we know that the Operating System is the interface which enables both the hardware and software to work together because it acts as a conduit.

There are different versions of OS which includes:

Windows 7Windows VistaWindows XpWindows 10, etc

Therefore, the correct answer is Operating System

Read more about Operating System here:

https://brainly.com/question/20870614

Which of the following is a professional organization in the field of IT?
Society for the Prevention of Cruelty to Animals (SPCA)
American Civil Liberties Union (ACLU)
Institute of Electrical and Electronics Engineers (IEEE)
American Medical Association (AMA)

Answers

Answer:

C. Institute of Electrical and Electronics Engineers (IEEE)

Explanation:

Edge 2020

Answer:

C.

Explanation:

look up the song 2055 it ia a vibe to do work to

Which step is first in changing the proofing language of an entire document?

A: Click the Language button on the Status bar.
B: Select the whole document by pressing Ctrl+A.
C: Under the Review tab on the ribbon in the Language group, click the Language button and select Set Proofing Language.
D: Run a Spelling and Grammar check on your document before changing the language.

Answers

Answer:

b) Select the whole document by pressing Ctrl+a.

Explanation:

The correct answer is b. If you do not select the whole document or parts of the document you wish to change the proofing language for, it will only be applied to the word your cursor is positioned in.

ig:ixv.mona :)

Answer:

B) Select the whole document by pressing Ctrl+A.

Implement a class Balloon that models a spherical balloon that is being filled with air. The constructor constructs an empty balloon. Supply these methods:

void addAir(double amount) adds the given amount of air.
double getVolume() gets the current volume.
double getSurfaceArea() gets the current surface area.
double getRadius() gets the current radius.

Supply a BalloonTester class that constructs a balloon, adds 100cm^3 of air, tests the three accessor methods, adds another 100cm3 of air, and tests the accessor methods again.

Answers

Answer:

Here is the Balloon class:

public class Balloon {  //class name

private double volume;  //private member variable of type double of class Balloon to store the volume

 

public Balloon()  {  //constructor of Balloon

 volume = 0;  }  //constructs an empty balloon by setting value of volume to 0 initially

 

void addAir(double amount)  {  //method addAir that takes double type variable amount as parameter and adds given amount of air

 volume = volume + amount;  }  //adds amount to volume

 

double getVolume()  {  //accessor method to get volume

 return volume;  }  //returns the current volume

 

double getSurfaceArea()  {  //accessor method to get current surface area

 return volume * 3 / this.getRadius();  }  //computes and returns the surface area

 

double getRadius()  {  //accessor method to get the current radius

 return Math.pow(volume / ((4 * Math.PI) / 3), 1.0/3);   }  } //formula to compute the radius

Explanation:

Here is the BalloonTester class

public class BalloonTester {  //class name

  public static void main(String[] args)    { //start of main method

      Balloon balloon = new Balloon();  //creates an object of Balloon class

      balloon.addAir(100);  //calls addAir method using object balloon and passes value of 100 to it

      System.out.println("Volume "+balloon.getVolume());  //displays the value of volume by getting value of volume by calling getVolume method using the balloon object

      System.out.println("Surface area "+balloon.getSurfaceArea());  //displays the surface area by calling getSurfaceArea method using the balloon object

             System.out.println("Radius "+balloon.getRadius());   //displays the value of radius by calling getRadius method using the balloon object

     balloon.addAir(100);  //adds another 100 cm3 of air using addAir method

       System.out.println("Volume "+balloon.getVolume());  //displays the value of volume by getting value of volume by calling getVolume method using the balloon object

      System.out.println("Surface area "+balloon.getSurfaceArea());  //displays the surface area by calling getSurfaceArea method using the balloon object

             System.out.println("Radius "+balloon.getRadius());    }  }  //displays the value of radius by calling getRadius method using the balloon object

//The screenshot of the output is attached.

Which quantity measures the rate at which a machine performs work?

Answers

Answer:

The SI unit of energy rate

Explanation:

is the watt, which is a joule per second. Thus, one joule is one watt-second, and 3600 joules equal one watt-hour.

Write some code that assigns True to the variable is_a_member if the value assigned to member_id can be found in the current_members list. Otherwise, assign False to is_a_member. In your code, use only the variables current_members, member_id, and is_a_member.

Answers

Answer:

current_members = [28, 0, 7, 100]

member_id = 7

if member_id in current_members:

   is_a_member = True

else:

   is_a_member = False

print(is_a_member)

Explanation:

Although it is not required I initialized the current_members list and member_id so that you may check your code.

After initializing those, check if member_id is in the current_members or not using "if else" structure and "in" ("in" allows us to check if a variable is in a list or not). If member_id is in current_members, set the is_a_member as True. Otherwise, set the is_a_member as False.

Print the is_a_member to see the result

In the example above, since 7 is in the list, the is_a_member will be True

How do the different layers of e protocol hierarchy interact with each other? Why do we need to have two different layers that work on error detection and correction?

Answers

I need free points please

How can templates be made available to other users?

A: your user profile directory
B: a shared network location
C: an intranet SharePoint document library
D: none of the above

Answers

Answer:

b

Explanation:

Which sentence describes Elif statements?
The program stops after the first false
answer.
The program can have only one statement.
The program runs after a false Elif
expression.
The program needs one true answer to run
after the If statement is false

Answers

Answer:

The program needs one true answer to run

after the If statement is false

Explanation:

Else-if statements are attached to If statements. They run if the If statement is false, and have their own condition. If their condition passes, they run their own block of code.

Answer:

the answer is D :)

Which describes the outlining method of taking notes?

It is easy to use in fast-paced lectures to record information.
It is the least common note-taking method.
It includes levels and sublevels of information.
It uses columns and rows to organize information.

Answers

Answer:

It includes levels and sublevels of information

Explanation:

The Outlining method of taking notes helps the writer to organize his ideas into levels and sublevels of information which gives the piece of writing an added structure.

This can be achieved by the use of the Arabic numbering system, Roman numerals or use of bullets.

Answer:

C : It includes levels and sublevels of information

Explanation:

which of these are the largest.a exabyte,,terabyte,,gigabyte or kilobyte

Answers

Answer:

I think a exabyte, if not its probably a terabyte

Explanation:

Which holds all of the essential memory that tells your computer how to be
a computer (on the motherboard)? *
O Primary memory
Secondary memory

Answers

The answer is: B
Hope that helps have a nice day purr:)

The Beaufort Wind Scale is used to characterize the strength of winds. The scale uses integer values and goes from a force of 0, which is no wind, up to 12, which is a hurricane. The following script first generates a random force value. Then, it prints a message regarding what type of wind that force represents, using a switch statement. You are to rewrite this switch statement as one nested 150 CHAPTER 4: Selection Statements if-else statement that accomplishes exactly the same thing. You may use else and/or elseif clauses.

ranforce = randi([0, 12]); switch ranforce case 0 disp('There is no wind') case {1,2,3,4,5,6} disp('There is a breeze') case {7,8,9} disp('This is a gale') case {10,11} disp('It is a storm') case 12 disp('Hello, Hurricane!') end

Answers

Answer:

ranforce = randi([0, 12]);

if (ranforce == 0)

     disp('There is no wind')

else  if(ranforce>0 && ranforce <7)

     disp('There is a breeze')

else  if(ranforce>6 && ranforce <10)

     disp('This is a gale')

else  if(ranforce>9 && ranforce <12)

     disp('It is a storm')

else  if(ranforce==12)

     disp('Hello, Hurricane!')

end

Explanation:

Replace all switch case statements with if and else if statements.

An instance is:

case {7,8,9}

is replaced with

else  if(ranforce>9 && ranforce <12)

All other disp statements remain unchanged

Nowadays computer games are mostly available on external
hard disk.
Is it true or false?

Answers

Answer:

false

Explanation:

because a lot of times they are downloads without the disk

It is false that nowadays computer games are mostly available on external hard disk.

What is hard disk?

A hard disk drive (HDD) is a type of computer storage device that uses magnetic storage to store and retrieve digital information.

Hard disks are usually located inside the computer and are used to store the operating system, applications, and user data such as documents, pictures, and videos.

Computer games can be stored on a variety of devices, including internal hard drives, external hard drives, solid state drives, and even cloud storage.

While external hard drives may be a popular option for some users, computer games can be installed and played from a variety of storage devices depending on user preferences and hardware capabilities.

Thus, the given statement is false.

For more details regarding hard disk, visit:

https://brainly.com/question/9480984

#SPJ2

PLEASE HURRY!!
Look at the image below!
Ignore the answer that I had accidentally selected.

Answers

the weight variable is an integer and the input is 115.6. Integers cannot have decimals, therefore, the output is 115.

Your answer should be 115

in programming and flowcharting, what components should you always remember in solving any given problem?

Answers

Answer:

you should remember taking inputs in variables

What is a clip art gallery

Answers

Clip art is a collection of pictures or images that can be imported into a document or another program. The images may be either raster graphics or vector graphics. Clip art galleries many contain anywhere from a few images to hundreds of thousands of images.

which type of memory helps in reading as well as writing data and modify data

Answers

Answer:

RAM (Random access memory)helps in reading aswell as writing data

can a computer Act on its own?

Answers

Answer:

hope this helps...

Explanation:

A computer can only make a decision if it has been instructed to do so. In some advanced computer systems, there are computers that have written the instructions themselves, based on other instructions, but unless there is a “decision point”, the computer will not act on its own volition.

PLEASE THANK MY ANSWER

Other Questions
Which sentences contain vague pronouns? Check all that apply. A. Bernardo reads both fiction and nonfiction, and he likes it a lot. B. After the play, Henrique told Isadora that her solo was excellent. C. Hiroto prepared so well for the debate that he crushed the competition. D. Vivian met Laura at the coffee shop where she works after school. E. When Mariana and Rahul studied with Lisa and Nico, it helped them. AME: Carmen estimates that she will spend $250 on new summer clothes. She actually spent $350. What is the percent error? Round to the nearest whole percent. Which organelle in this image is the packaging unit of the cell that packages proteins for transfer throughout the cell?1869 The sum of four consecutive integers is 298. What is the largest integer? The drama club is selling tickets to their play to raise money for the show's expenses. Each student ticket sells for $4 and each adult ticket sells for $8.50. The auditorium can hold at most 79 people. The drama club must make no less than $460 from ticket sales to cover the show's costs. If 53 student tickets were sold, determine the minimum number of adult tickets that the drama club must sell in order to meet the show's expenses. If there are no possible solutions, submit an empty answer. What was a direct effect of the Granges businesses failing in the late 1800s? will made his mini pecan tarts for the southern themed school party he bought 20 pounds (320 ounces) of pecans for $78.40 he put 2 ounces of pecans in each pecan tart he made what was the cost of the pecans in each mini pecan tart Madison wants to bake 5 cakes for the churchfestival. She needs 1 3/4 cups of flour and 21/2 cups of sugar for each cake. How muchsugar will she need for the 5 cakes? 7y4(9/4y6). simplified Who did France go to war Based on the sources and your knowledge of US history, determine whether wealthy businessmenfrom the Second Industrial Revolution Era should be remembered more so in a negative light asRobber Barons or positively as "Captains of Industry".As you write, follow the directions below. Address all parts of the prompt. Include information and examples from your own knowledge of US history,Use evidence from the sources to support your response. b) Write the following numbers in order of size.Start with the smallest number.0.054 0.54 0.450.405o8 For the fair, the organizers ordered 33 rolls of tickets. Each roll of tickets has 100 tickets. How many tickets were ordered in all? If l is parallel to m find the value of each missing variable What is 29 multiplied by 84 Pythagorean Therom.What is the length of segment AB? HELPPPPPP ME PLEASE!!!! Why did Neil Armstrong leave college? which of the following is an example of a picture plane?a) A potters bowl b) A sculptor's clayc) An architectures buildingd) a painters canvas any help would be highly appreciated thank you What city in the Kingdom of Kush became known for producing iron weapons? Solve 8x-3y=14 for y