Project: fluid flow | Computer Science homework help

·         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

radius

 

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

height

 

 

 

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 calledWaterTank.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:

Enter the height of the cylindrical tank, in inches: 36

 

Enter the radius of the cylindrical tank, in inches: 6

 

Initial 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):

=   2

 

Velocity of Outward Flow Through the Nozzle:

= 8.02 ∗ √(                                      )

 

Volume Lost From a Cylinder At Time t:

=       ∗ (4  ) ∗

 

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.

 

Sample Tests

 

Enter the height of the cylindrical tank, in inches: 240

Enter the radius of the cylindrical tank, in inches: 12

Initial Volume: 108573.44 cubic inches.

 

Time

Volume Lost

Fluid Height

====

===========

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

0

0.00

240.00

1

1561.31

236.55

2

3100.09

229.70

3

4582.29

219.57

4

5973.48

206.36

5

7238.85

190.36

6

8343.05

171.92

7

9250.06

151.47

8

9922.94

129.54

9

10323.44

106.72

10

10411.24

83.70

11

10142.60

61.28

12

9467.56

40.36

13

8323.01

21.96

14

6611.62

7.34

15

4096.50

-1.71

 

 

 

Enter the height of the cylindrical tank, in inches: 84

Enter the radius of the cylindrical tank, in inches: 2.5

Initial Volume: 1649.34 cubic inches.

 

Time

Volume Lost

Fluid Height

====

===========

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

0

0.00

84.00

1

923.68

36.96

2

1225.36

-25.45

 

 

 

Enter the height of the cylindrical tank, in inches: 72

 

Enter the radius of the cylindrical tank, in inches: 8

 

Initial Volume: 14476.46 cubic inches.

 

Time

Volume Lost

Fluid Height

 

 

 

====

===========

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

0

0.00

72.00

1

855.17

67.75

2

1659.05

59.50

3

2332.10

47.90

4

2789.95

34.02

5

2939.16

19.40

6

2663.55

6.15

7

1750.20

-2.55

 

 

 

Enter the height of the cylindrical tank, in inches: 128

Enter the radius of the cylindrical tank, in inches: 22

Initial Volume: 194627.95 cubic inches.

 

 

Time

Volume Lost

Fluid Height

 

 

====

===========

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

 

 

0

0.00

128.00

 

 

1

1140.22

127.25

 

 

2

2273.75

125.75

 

 

3

3390.53

123.52

 

 

4

4480.45

120.58

 

 

5

5533.36

116.94

 

 

6

6539.06

112.64

 

 

7

7487.31

107.71

 

 

8

8367.80

102.21

 

 

9

9170.15

96.18

 

 

10

9883.88

89.68

 

 

11

10498.45

82.78

 

 

12

11003.15

75.54

 

 

13

11387.12

68.05

 

 

14

11639.32

60.40

 

 

15

11748.39

52.67

 

 

16

11702.60

44.97

 

 

 

 

 

 

 

17

11489.67

37.42

 

 

18

11096.54

30.12

 

 

19

10508.84

23.21

 

 

20

9710.15

16.82

 

 

21

8680.25

11.11

 

 

22

7391.17

6.25

 

 

23

5795.73

2.44

 

 

24

3778.22

-0.04

 

 

 

 

 

 

Submit your .java file. Be sure to use coding guidelines: no longer than 80 column width, comment each line above or next to each statement ending in a semicolon, use javadoc comments where necessary

Custom Writings Help
Calculate your paper price
Pages (550 words)
Approximate price: -

Why Work with Us

Top Quality and Well-Researched Papers

We always make sure that writers follow all your instructions precisely. You can choose your academic level: high school, college/university or professional, and we will assign a writer who has a respective degree.

Professional and Experienced Academic Writers

We have a team of professional writers with experience in academic and business writing. Many are native speakers and able to perform any task for which you need help.

Free Unlimited Revisions

If you think we missed something, send your order for a free revision. You have 10 days to submit the order for review after you have received the final document. You can do this yourself after logging into your personal account or by contacting our support.

Prompt Delivery and 100% Money-Back-Guarantee

All papers are always delivered on time. In case we need more time to master your paper, we may contact you regarding the deadline extension. In case you cannot provide us with more time, a 100% refund is guaranteed.

Original & Confidential

We use several writing tools checks to ensure that all documents you receive are free from plagiarism. Our editors carefully review all quotations in the text. We also promise maximum confidentiality in all of our services.

24/7 Customer Support

Our support agents are available 24 hours a day 7 days a week and committed to providing you with the best customer experience. Get in touch whenever you need any assistance.

Try it now!

Calculate the price of your order

Total price:
$0.00

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

Our Services

No need to work on your paper at night. Sleep tight, we will cover your back. We offer all kinds of writing services.

Essays

Essay Writing Service

No matter what kind of academic paper you need and how urgent you need it, you are welcome to choose your academic level and the type of your paper at an affordable price. We take care of all your paper needs and give a 24/7 customer care support system.

Admissions

Admission Essays & Business Writing Help

An admission essay is an essay or other written statement by a candidate, often a potential student enrolling in a college, university, or graduate school. You can be rest assurred that through our service we will write the best admission essay for you.

Reviews

Editing Support

Our academic writers and editors make the necessary changes to your paper so that it is polished. We also format your document by correctly quoting the sources and creating reference lists in the formats APA, Harvard, MLA, Chicago / Turabian.

Reviews

Revision Support

If you think your paper could be improved, you can request a review. In this case, your paper will be checked by the writer or assigned to an editor. You can use this option as many times as you see fit. This is free because we want you to be completely satisfied with the service offered.

})();