A constructor that accepts a parameter of type double

Assignment Help Computer Engineering
Reference no: EM132197002

Write a class named GasTank containing: An instance variable named amount of type double , initialized to 0.

An instance variable named capacity of type double .

A constructor that accepts a parameter of type double .

The value of the parameter is used to initialize the value of capacity.

A method named addGas that accepts a parameter of type double .

The value of the amount instance variable is increased by the value of the parameter .

However, if the value of amount is increased beyond the value of capacity, amount is set to capacity.

A method named useGas that accepts a parameter of type double .

The value of the amount instance variable is decreased by the value of the parameter .

However, if the value of amount is decreased below 0, amount is set to 0.

A method named isEmpty that accepts no parameters .

isEmpty returns a boolean value : true if the value of amount is less than 0.1, and false otherwise.

A method named isFull that accepts no parameters .

isFull returns a boolean value : true if the value of amount is greater than capacity-0.1, and false otherwise.

A method named getGasLevel that accepts no parameters . getGasLevel returns the value of the amount instance variable.

A method named fillUp that accepts no parameters .

fillUp increases amount to capacity and returns the difference between the value of capacity and the original value of amount (that is, the amount of gas that is needed to fill the tank to capacity). In Java please!

Reference no: EM132197002

Questions Cloud

Write a constructor that accepts arguments for each member : Write a constructor that accepts arguments for each member variable, appropriate mutator functions that store values in these member variables.
Write the code for an applet or gui that has three buttons : Write the code for an applet or GUI that has three buttons labeled Red, White, and Blue.
Write a persuasive and researched essay : Pick an item of technology (your choice); then write a persuasive and researched essay - Is the item of technology good or bad for the United States
Write a class and a java program to use the class : A constructor that receives 2 double parameters; the constructor will use these parameters to initialize the incomeYTD and the hourlyRate respectively.
A constructor that accepts a parameter of type double : Write a class named GasTank containing: An instance variable named amount of type double , initialized to 0.
Write accessor and mutator functions for radius : Write a class declaration named Circle with a private member variable named radius. Write accessor and mutator functions for radius.
Write a client program that connects to the server : Write a client program in C/C++ that connects to the server you wrote in problem.
Discuss an episode of government intervention : BFW2341 International Financial Management - Monash university - Evaluation of government intervention in the foreign exchange market
Write a client class to test all your methods : Write a class encapsulating the concept of a Student, assuming that a student has the following attributes: last name, first name, id, array of grades.

Reviews

Write a Review

Computer Engineering Questions & Answers

  What indicates the big-o value

What indicates the Big-O value of a given method (or algorithm) - What represent the best-case, average-case and worst-case performance of an algorithm?

  What is the difference between an algorithm and a program

What is the difference between an algorithm and a program? How can computers represent pictures as numbers? How can computers represent text as numbers?

  Create pivot tables and pivot charts to analyze sales

In this project you will create pivot tables and pivot charts to analyze sales, customer and product data. Cleanse the data- Open Pivot Analysis Raw Data and save it as Pivot Analysis your name completed. Review and interpret the data. Resize and/or ..

  Design menuitem class that stores two pieces of information

Design a simple MenuItem class that stores only two pieces of information- the name of a menu item, and whether it is a vegetarian dish or not.

  Evaluate air properties at a given film temperature

A manufacturer makes absorber plates that are 1.2 m × 0.8 m in size for use in solar collectors. The back side of the plate is heavily insulated.

  Write recursive function that takes as input number of rows

Write a recursive function that takes as input the number of rows, n, and outputs the total number of pins that would exist in a pyramid with n rows.

  List and explain two different possible and credible ways

List and explain two different possible and credible ways that the patient data could leak out

  Describe a nonrecursive method for evaluating a binary tree

Describe a nonrecursive method for evaluating a binary tree representing an arithmetic expression.

  Methods to target certain audience

Recognize a particular website which you frequently go to and explain the targeted audience which visit that particular site. Provide explanation how the site is developed for its certain target audience.

  A function to see if one list is a shallow copy of other

A function to see if one list is a shallow copy of other

  How many bytes of memory is this

Suppose that you discover that RAM addresses 000C0000 to 000C7FFF are reserved for a PC's video adapter in a 32-bit computer.

  Design a software solution to a problem in your life

Using tools and concepts learned this week to design a software solution to a problem in your life.

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