Question

(miles per gallon) for a series of enter a miles value and a gallons counter loop to ensure that the 14. [after §2.9-easy] Loop Termination by Counter-Pseudocode Write a pseudocode algorithm that calculates and prints the overall MPG miles and gallons user inputs. Use a loop to repeatedly ask the user to en value. Within the loop, accumulate miles and gallons separately. Use a loop repeats three times. The algorithm should generate a display of prom looks like this (italicized values are user inputs): inputs, and final output that Sample session: Enter miles: 10 Enter gallons: 1 Enter miles: 20 Enter gallons: 2 Enter miles: 10 Enter gallons: 2 Overall MPG 8 Provide a graceful response if the total gallons equals zero. Please answer it by easy JAVA pseudocode. Thanks
0 0
Add a comment Improve this question Transcribed image text
Answer #1

The pseudocode for the above program in java is as follows:

Pseudocode:

1. Enter number of times you want to calculate for .

Save it in number

2. Enter miles in the integer mile.

Enter gallons in the integer gall.

3. Ask the user value until the limit is reached for the number.

for(i=0;i<number;i++)

4. Now, calculate miles per gallon with the help of given formula

int milespergallon = mile/gall;

5. int overall = milespergallon/number;

Output overall;

Rate an upvote.......Thankyou

Hope this helps......

Add a comment
Know the answer?
Add Answer to:
Please answer it by easy JAVA pseudocode. Thanks Write a pseudocode algorithm that calculates and prints...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • This is a C program. please help me to write a pseudocode of the program ....

    This is a C program. please help me to write a pseudocode of the program . also, I want the program In a do...while loop and the screen output should look like in the picture. please help me. 3.1. Write a program that asks the user to continue to enter two numbers (at a time). For each pair of numbers entered, the program calculates the product of those two numbers, and then accumulate that product. For each pair of numbers...

  • You previously wrote a program that calculates and displays: Miles driven Miles per gallon Kilometers driven...

    You previously wrote a program that calculates and displays: Miles driven Miles per gallon Kilometers driven Liters of fuel consumed Kilometers per liter Messages commenting on a vehicle's fuel efficiency And also validates input Now we'll make a somewhat major change. We'll remove the code for obtaining input from a user and replace it with hardcoded data stored in lists. Because the data is hardcoded, the program will no longer need the code for validating input. So, you may remove...

  • COP 2220 Into programming in C(Answer in C, not C++). The question is: Please write the...

    COP 2220 Into programming in C(Answer in C, not C++). The question is: Please write the algorithm for a AppStore programming assignment. The details of the assignment, a sample algorithm, and its outline, are located below. Make the algorithm at least half a page, easy to read, and to understand, how it works. I just want the algorithm, not the programming code, I have that. I only need the ALGORITHM. Thanks for helping me out, I apprieciate it, have a...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT