Create a java class called watertank

Assignment Help JAVA Programming
Reference no: EM13754663

 The use of standard Java input and output mechanisms

· The use of complex arithmetic expressions

· The use of modular design (methods)

· The use of one-dimensional arrays

As always, be sure to properly document your code. Consult the Java Coding Guidelines document for proper coding standards. Use good design principles and design the solution before attempting to write code.

Emptying a Water Tank

Water catchment systems are a critical source of water in many parts of the world. These systems collect rainwater and distribute it to a house, lodging, or neighborhood using a series of gravity-propelled plumbing. Such systems can also act as a reservoir by which local populations can "fill up" containers and transport the water to other locations.

Assume we have a full water catchment tank, shaped like a cylinder. How long would it take to empty that cylinder, if we "unscrewed" an output nozzle on the bottom? Determining the rate at which the cylinder would empty out would require knowledge of the height of the tank, the radius of the tank, and the radius of the output nozzle. Once we had this knowledge, we could apply a few simple math equations to get an approximate answer. This information would be helpful to measure the amount of water that would be used for various household uses (e.g. showers).

Exercise #1: Create a Java class called WaterTank.java. This program will simulate thedraining of a cylindrical water catchment tank. Your program will need to show how the rate at which water would exit the tank, assuming an output nozzle two inches (2") in diameter. Your inputs are as follows:

 

 

Variable

 

 

Meaning

 

 

Valid Range

 

 

 

 

height_of_tank

 

The height of the cylindrical tank, in inches

[72-240]

 

 

 

 

radius_of_tank

 

The radius of the cylindrical tank, in inches

[2-36]

 

 

 

Note that the values above will be input from the user only once. Both inputs are double values.

Once the input is finished, your program will display an output table with three columns: time (in seconds), volume lost, and fluid height (i.e. the height of the water in the cylindrical tank). Assuming a constant flow, the volume of water in the tank will decrease to zero over time (i.e. the tank will be empty). For example, a 36-inch high cylinder with a radius of 6 inches will produce the following table:

Intial Volume: 4071.50 cubic inches.

 

 

 

Time

Volume Lost

Fluid Height

====

===========

============

0

0.00

36.00

1

604.69

30.65

2

1115.97

20.79

3

1378.45

8.60

4

1182.06

-1.85

 

 

 

Note that the last value - and only the last value - for fluid height may be less than zero. Youshould assume the tank is initially full with water. Your table should compute one value for each second, starting at zero and ending when the tank runs dry (i.e. volume of fluid in the tank is ≤ 0).

The following constants and formulas will be helpful in your calculations (r = radius, h = height):

PI (π):

3.14159265

Initial Volume of a Cylinder (i.e. the water tank):

Velocity of Outward Flow Through the Nozzle:

Volume Lost From a Cylinder At Time t:

Height of Fluid in the Cylindrical Tank at Time t:

Note that you will first need to calculate the volume of the cylinder when it is full, and output it to the screen. For each time step, you will need to calculate the volume lost. Remember that the volume lost requires you to first calculate the velocity of flow. Once calculated, the volume lost is subtracted from that initial "full" volume. Afterwards, the new height of the fluid can be calculated from this new volume. When the volume in the tank reaches zero (or less), your program should stop its calculations. Your program may use the value of PI (π) shown here for testing purposes, or use the Math.PI constant.

Your numerical output should be precise to two decimal places on the right of the decimal for all real-number data. Your ability to modularize your solution is essential (i.e. break the program into methods). You must use arrays in your solution - at least two arrays are recommended to store the volume lost and fluid height values. Be sure to properly document your code and use good design principles

Reference no: EM13754663

Questions Cloud

Create a gantt chart for the project : Create a Gantt chart for the project. Compare and contrast the information that one receives from a Gantt chart, versus that of a PERT diagram
Need an outline for u.s. foreign policy paper : Need an outline for U.S. Foreign Policy paper "In light of the current proxy war between Shia Iran and Sunni Saudi Arabia, is the current U.S. Foreign policy failing or strategic realignment? " This is only for an outline for a paper that will be 5-6..
What is the rationale for allocating the 50-b : What is the rationale for allocating the 50-b package to developing technologies as opposed to reaching consensus on what could be implemented?
Why hitler came to power in germany in january in 1933 : Give two reasons why Hitler came to power in Germany in January in 1933.
Create a java class called watertank : Create a Java class called WaterTank.java. This program will simulate thedraining of a cylindrical water catchment tank. Your program will need to show how the rate at which water would exit the tank, assuming an output nozzle two inches (2") in d..
Describe the project requirements and other assumptions : Summarize the project requirements and other assumptions (i.e., budget, human resources, workload, environmental dependencies, etc.). Define a work breakdown structure and describe the methodology behind constructing one
Compare and contrast the presidential elections : Compare and contrast the presidential elections of 2004 and 2012 on the following factors: 1) Election results; 2) Voter turnout; 3) Campaign strategies.
What is one reason that media outlets : What is one reason that media outlets might be consderate subjective rather objective
Equality in america : What about our treatment of other nations and Does our mantra of equality apply to them? This week your written assignment is to resolve the apparent conflict between Thomas Jefferson's statement "that all men are created equal" and the concept of..

Reviews

Write a Review

JAVA Programming Questions & Answers

  Solving programming problems

Write a computer program that will figure out the total of an order when given the amount of the order ($1000) and a sales tax rate of eight percent.

  Prepare address book java application

Prepare an application that reads the contents of your address book file and prepare a user guide that includes a description of the functionality of your overall address book system.

  Shooting star

Initial project folder you will see the beginnings of a Driver - You need to implement that DoubleListOfBlock methods so they perform

  It inherits the functionality of super class

It inherits the functionality of super class Package and contains an additional data member representing an additional fee per ounce charged for overnight-delivery service.

  What about percent values and currencies

List three debugging techniques, within the debugger, that can be used to locate logical error in the Java code. For each of these tools, explain what purpose it serves, and how it relates to the debugging process.

  List data structures to be used in solution

write a program that will prompt the user for an input file name to read from. The Input file will consist of records made up of first name, last name and an account balance of individuals and store the individuals in an ArrayList.

  Write java program prints strings given at command line

Write down the program Average.java which just prints strings which it is given at command line, one per line. If nothing is given at command line, print "No arguments".

  Write a java program that finds the temperature

Write a JAVA program that finds the temperature that is the same in both Celsius and Fahrenheit.

  Build the gui layout of the gamecreate a class called

build the gui layout of the gamecreate a class called pipegameapp.java which will be the main game user interface. the

  Describe which base class members may not be inherited

Without considering the access attributes, list and describe which base class members may not be inherited by a derived class and provide a rationale for why this is.

  Modify the book class to accommodate multiple authors

modify the Book class to accommodate multiple authors using one of the components from the Java Collection Framework.

  Java code that needs to be coded-complex number class

Just a Java Code that needs to be coded. Your given the design, just needs the methods and such to be fixed. This is for a Complex Number class.

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