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

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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