Question
Hello, please completely read the entire instructions and try to follow its guidelines. This is from a beginner java programmer class so please nothing to
Hello, please completely read the entire instructions and try to follow its guidelines. This is from a beginner java programmer class so please nothing to extravegant. A lot of the for and if statments involve using .length so please try to incorporate that if possible. Just not to far advanced that I should not know it. Thank you so much for your help! Below are the instruction and in there it will tell you everyhitng on what should inside the code. I have posted this question before but I did not get the right output. So please read the lab and if anyone can help I really apreciate it. Thank you so much! x
Writing user defined data types Fuel Efficiency Calculator For this lab you will write a class encapsulating the concept of a Fuel Efficiency Calculator that will be used to track the fuel efficiency of an automobile and the average cost per gallon. It could be used to calculate the fuel efficiency on a particular trip, or to compare the fuel efficiency for highway travel vs. city travel, etc... YOU SHOULD READ THIS ENTIRE LAB FIRST, BEFORE YOU BEGIN TO PROGRAM THE SOLUTION! The FuelCalculator class is an Abstract Data Type (ADT). It defines a new type. A FuelCalculator has the following attributes: Instance variables: An integer representing the miles driven A double representing the gallons of gas consumed. A double representing the total cost of the gas used Methods: " mutator methods that can be used to: reset-resets the miles driven to 0 and gallons of gas used to 0 . logMiles - adds: the number of new miles driven the gallons of gas used to drive those miles the cost of that gas . accessor methods do the following: . . . . . get the miles driven get the gallons of gas used get the total cost of the gas used get the fuel efficiency for this trip in miles per gallon get the average cost of a gallon of gas equals method compares the fuel efficiency of two FuelCalculators. Two FuelCalculators are equal if their fuel efficiency is equal within a tenth of a gallon gas used per mile travelled. " toString method returns a String that contains the values for the miles driven, gallons used and the fuel efficiency in the format: Miles Driven: ## Gas Used: ##.4 gallons Efficiency: ##.# mpg Total Cost: $ # ## Average Cost: $ ## # per gallon
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started