Drivers are concerned with the mileage their vehicles get. One driver has kept track of several tankfuls of fuel by recording the kilometres(km) driven and litre of fuel used for each tankful. Develop a java application that will input the kms driven and litre of fuel used (both as integers) for each tankful. The program should calculate and display the km per litre obtained for each tankful and print the combined km per litre obtained for all tankfuls up to this point. All averaging calculations should produce floating point results. Use class Scanner and sentinel-controlled repetition to obtain the data from the user.

View Answers

Ads

Related Tutorials/Questions & Answers:

integers an application that finds the smallest of several integers. assume the first value read specifies the number of values to input from the user. please help

Advertisements

the user and displays i) the sum of all even integers between 1 and the input value, both inclusive. ii) The sum of all odd integers between 1 and the input value both inclusive Example: User enters 7. Sum of even integers = 2+4+6 = 12 Sum

Integers separated by a ", " in a string How do I get integers separated by a ', ' in C++ in a string? Ex. string=1, 2, 3; //something to find the integers and put them in array a cout< output: 123 Hi Friend

ModuleNotFoundError: No module named 'artisinal_integers' Hi, My... named 'artisinal_integers' How to remove the ModuleNotFoundError: No module named 'artisinal_integers' error? Thanks Hi, In your

ModuleNotFoundError: No module named 'artisinal_integers' Hi, My... named 'artisinal_integers' How to remove the ModuleNotFoundError: No module named 'artisinal_integers' error? Thanks Hi, In your

how to find the sum of integers in a string of sentence in java how to find the sum of integers in a string of sentence in java for e.g:--> abc d 2 3 21 the output should be 2+3+21=26

how to find [count the number of integers whose value is less than the average value of the integers] Construct an algorithm that will prompt... amount to the screen integers from an operator at a terminal, and count the number

write a java program to find the summation of all the integers entered... the integers entered on command line? How to write Java program for summation of all the integers entered on command line? Thanks Hi, Example program

Write a program that (algorithmically) shows a times table.(convert integers to strings, format text, nested loops) Write a java program that (algorithmically) shows a times table.(convert integers to strings, format text

Integer exception in java The integer class is a wrapper for integer value. Integers are not objects. The Java utility classes require the use of objects. If you

signum method. Method return type is int therefore method returns integers... analyzing, method returns only one integer among these three integers -1... bigdecimal value, method result will be among the these three integers -1

Non-atomic Types Values of atomic data types cannot be sub divided further. It can be either primitive or derived like strings, integers, decimals, dates etc. XML Schema provides two non atomic types lists and unions. Non atomic data

help pleas? -_- Write a Java program that reads from the user an integer N followed by N integers. The program then prints the product of odd integers, and, the sum of even integers

(10) integers and keep these integers in an array named num[]. Next display in reverse order all the integers that are greater than 15, and calculate and display the total of all integers that are smaller than 15. Use for loops for all

C++ Trace the bubble sort using the following integers,which represent the elements in an array. 5,7,3,8,6,7,3

) of two integers. For example, if the two integers are 6 and 15, the gcd is 3. Another example, if the two integers are 8 and 25, the gcd is 1. The two integers... to enter two integers, computes the gcd of the two integers by calling the GCD

java Construct a Java program that will read a list of integers from a file named number.txt. The program will sum all the integers and keep the total in another file named total.txt. Assume that each integer in the input file

Validations Hi I need to validate blank text field that can accepts only integers. Here is my code if(textField_1.getText().length()==0... this;but it fails to show message for integers. Please help

Java Interview Question Java program Interview Question :i have a file which contains characters and integers in mixed format. for example :-->... will be on the left side and all integers will be on the right side of the file

integers and these integers will be kept in a multidimensional array of three rows... and the total of all these integers will be displayed in another row. If the word... these integers will be displayed in another row. If none of these two choices is given

n raised to power p wap to input 2 integers n and p.find and print n raised to the power p without using Math.pow() function

integer with a list of integers from a file named data.txt. The program will keep count of the number of integers in the file that are smaller than, equals... interface all the counters that represent the number integers in the file

an array of distinct integers and returns the smallest number. (If this is too... takes an array of integers and reverses it. 3) write a function isDistinct which takes an array of integers and returns a boolean, indicating

Java The factorial of an integer m is the product of conrective integers from 1 to m. that is factorial m=m!=m(m-1)........*1 write a program that computer and prints a table of factorial for any given m

transpose of matrix write a program in java to declare a square matrices 'A' or order n which is less than 20.allow in user to input only positive integers into the matrix and print the transpose

help me to solve this question Write a program that inputs a series of integers into an array. The numbers are in the range 0 to 100. Calculate and display : a) The Largest number b) The Smallest Number c)The sum of the numbers

programes on while loop write a program to calculate sum of an entered digit write a program to find gcd and lcm of 2 positive integers Java sum of digits Java Find LCM and GCD