How many gallons the cars gas tank holds

Assignment Help JAVA Programming
Reference no: EM131663725

Programming Project

Submission Instructions

Open Eclipse and create a Java Project called Project1. Add a class named RoadTrip to this project.

At the top of your file, enter a comment with your name, the assignment number, the date, and a short description of what the program does. For example, if I were submitting the assignment my comment might look like this:

/**
* Author: Susanne Sherba
* Programming Project 1
* October 2, 2016
* Calculates gallons of gas needed and number of stops for a road trip.
*/

When you are finished, export your project from Eclipse and upload it to Canvas before the due date. To do this, right click on the project name and select Export. Select General->Archive File and click Next. Select the project you wish to export (Project1 in this case) and click Browse to browse to a location to save your file.

Assignment

You and your friends are planning a road trip. Write a program that asks the user for information about where they are going and the car they are driving and then gives them some helpful information about their trip. Specifically, you should ask the user for:

• the name of the city they are leaving from
• the name of the city they are going to
• the distance between the two cities
• how many miles per gallon their car gets
• how many gallons the car's gas tank holds

You should output the name of the starting and ending cities, the number of gallons of gas the trip requires (with one decimal place) and the number of stops you will need to make along the way (as an integer). Make sure the city names are capitalized, even if the user didn't capitalize them. You may assume that your gas tank is full at the beginning of the trip.

Here's a sample interaction with the user:

Enter city you are leaving from: denver
Enter city you are driving to: jacksonville
Enter distance in miles: 1748
Enter miles per gallon your car gets: 34
Enter the number of gallons your car's tank holds: 15.3

Your trip from Denver to Jacksonville will require 51.4 gallons of gas.

Assuming your gas tank is full when you leave, you will need to stop to fill up 2-3 times.

Reference no: EM131663725

Questions Cloud

Purpose and value to using arrays : Describe the purpose and value to using arrays and functions in C++ programming.
Differentiate gross margin and contribution margin : Gross margin and contribution margin. The Museum of America is preparing for its annual appreciation dinner for contributing members.
Unique category of computer problems : Consider the following statement: "Network problems are not really a unique category of computer problems; all network problems are basically either hardware
What will be the average time waiting in the system : What will be the average time waiting in the system? What will be the average time in the system.
How many gallons the cars gas tank holds : Write a program that asks user for information about where they are going. How many miles per gallon their car gets? How many gallons the car's gas tank holds?
Unix or linux for operating systems : Briefly, explain why corporations are increasingly interested in using Unix or Linux for their operating systems? one to two paragraph
Is the cost of the ehr worth the effort and struggle : Is the cost of the EHR worth the effort and struggle?
Summary be a part of the research paper : It does not clearly state it, but can the executive summary be a part of the research paper or should it be its own document?
Several file servers with multiple shared folders : You work for a corporation that has several file servers with multiple shared folders. You want to make it easier for users to access the shared folders.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Create a treemap of course names

Create a TreeMap of course names. Each map entry should contain a single integer that counts the number of students who have enrolled in that course

  Complete the classes cipher - caesar and transpose

Complete the classes Cipher, Caesar, and Transpose, and Reverser - Define an interface called Constants that will store the value 26 in the identifier WRAP_AROUND;

  Class named stock to model a stock

Write a class named Stock to model a stock. The properties and methods of the class are shown in Figure 6.22. The metho changePercent computes the percentage of the change in the current vs. the previous closing price.

  What would be an incorrect way of writing this equation

Jim develops 5 Java applications a year. Joe develops 10 Java applications a year. Jim gets paid $5000.00 per application, but Joe gets paid $10000.00 per application.

  The access modifier of constructors should be

The access modifier of constructors should be

  Determine whether or not there exists sequence of currencies

Suppose that we are given n currencies. Give an efficient algorithm to determine whether or not there exists a sequence of currencies.

  Write a java program that inputs a string

Write a program that inputs a string similar to: 3 + 4 * 2 / ( 1 - 5 ) ^ 2 ^ 3. Your program should apply the Shunting-yard algorithm to this string to ultimately produce a mathematical result.

  Write a comparator class that compares products by price

Write a comparator class that compares Products by price. Declare a priority queue that uses the comparator class in number 3 to compare Products.

  Complete the code found in player.java

You are to complete the code found in Player.java. Once completed you can then simulate a good old game of Rock, Paper, Scissors. To play you need to compile Player.java, InputMaker.java, and RockPaperScissorsTest.java. Then you will run InputMake..

  Which correctly creates an array of five empty strings

Which correctly creates an array of five empty Strings? Which of the following statements is preferred to create a string "Welcome to Java"?

  Write a class that implements an ordered list of strings

In this problem you will write a class that implements an ordered list of Strings.

  Difference between the two website forms

What was the main difference between the two website forms? Would the "NC Veterans Memorial" website benefit from the use of a Contact Us form? If so, why, and what fields should be included in the form?

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd