Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Java Expert


Home >> Java

You will create a program that will approximate the volume of cheese in a rectangular hunk of Swiss cheese. For this approximation you will assume that the holes in the Swiss cheese are of two types: spherical bubbles (all of the same size) or cylinders (also of the same size).

Your program should include 6 functions in addition to your main function:

  • A void function that will *robustly confirm that the dimension entered is greater than zero. This function should accept 2 arguments: the dimension and what it is. You will call this function 6 times (to check: height of cheese, length of cheese, width of cheese, radius of spheres, radius of cylinders, height of cylinders).
  • A void function that will *robustly confirm that the number entered for holes is greater than zero. This function should accept 2 arguments: the number of holes and what that number corresponds to: spherical bubbles or surface cylinders. You will call this function 2 times.
  • A value-returning function that will accept the radius of a sphere, and then calculate and return the volume of that sphere (vol = 4/3pr3).
  • A value-returning function that will accept the radius and height of a cylinder, and then calculate and return the volume of that cylinder (vol = pr2h).
  • A value-returning function that will accept the height, length, and width of a rectangular parallelepiped and then calculate and return the volume of the rectangular parallelepiped   (vol = hlw).
  • A value-returning function that will accept 8 parameters: (1)width, (2)length, and (3)height of the rectangular hunk of cheese; the (4)number of spherical bubbles and the (5)radius of the bubbles; plus the (6)number of cylindrical holes in contact with a surface and the (7)radius and (8)height of these cylinders. This function will call the functions to calculate the volumes, and then subtract the volumes of spherical bubbles and surface cylinders from the total possible volume of the parallelepiped. The final volume should be returned to main() via the function call. If the volume of cheese is negative, you should handle this appropriately in main().

Your main function should ask the user to input the dimensions of the parallelepiped, the number and size of the spherical bubbles, and the number and dimensions of the surface cylinders. For each of these 8 values your main function should call the functions to confirm input is greater than 0. After this confirmation, the function to approximate the volume of cheese should be called. Then main should output the approximate volume of cheese present. DO NOT assume that the total volume of spherical bubbles and surface cylinders will not exceed the volume of the original hunk.

Make sure you use appropriate data types and that your submission follows the assignment guidelines posted on ANGEL. The value of pi should be declared as a global constant of 3.14159.

Note: for the "what it is" portion of the validity-checking functions, you will need to use a variable type that holds multiple characters.

*robustly confirm: if the item in question is invalid, the function will repeatedly check to make sure that valid input is eventually obtained.

 

Java, Programming

  • Category:- Java
  • Reference No.:- M9455965

Have any Question?


Related Questions in Java

Overviewyou are required to use java se 80 and javafx to

Overview You are required to use Java SE 8.0 and JavaFX to develop a Graphical User Interface (GUI) for the FlexiRent rental property management program created in Assignment 1. This assignment is designed to help you: 1 ...

Project descriptionwrite a java program to traverse a

Project Description: Write a java program to traverse a directory structure (DirWalker.java) of csv files that contain csv files with customer info. A simple sample in provided in with the sample code but you MUST will r ...

Answer the following question whats the difference public

Answer the following Question : What's the difference public inheritance and private inheritance? What can derived classes inherit from base classes? What cannot be inherited from base classes?

Assessment socket programmingtaskwrite a java gui program

Assessment: Socket Programming Task Write a JAVA GUI program that would facilitate text chatting/exchanging between two or multiple computers over the network/internet, using the concept of JAVA socket programming. If yo ...

Can someone help me please with those question1what is the

Can someone help me please with those question 1:what is the best data type for student id datatime,currency,number,decimal 2:which relationshipis preferable? one to one,one to many,many to many 3:if you add table A's pr ...

Can someone kindly help me to consider whether java

Can someone kindly help me to consider whether Java provides the facility of operator overloading? If it does, may you kindly describe how overloading operators can be accomplished? If not, may you kindly describe why yo ...

In relation to javaa what is constructor the purpose of

(In relation to Java) A. What is constructor? the purpose of default constructor? B. How do you get a copy of the object but not the reference of the object? C. What are static variables and instance variables? D. Compar ...

Assessment socket programmingtaskwrite a java gui program

Assessment: Socket Programming Task Write a JAVA GUI program that would facilitate text chatting/exchanging between two or multiple computers over the network/internet, using the concept of JAVA socket programming. If yo ...

Overviewyou are required to use java se 80 and javafx to

Overview You are required to use Java SE 8.0 and JavaFX to develop a Graphical User Interface (GUI) for the FlexiRent rental property management program created in Assignment 1. This assignment is designed to help you: 1 ...

Fundamentals of operating systems and java

Fundamentals of Operating Systems and Java Programming Purpose of the assessment (with ULO Mapping) This assignment assesses the following Unit Learning Outcomes; students should be able to demonstrate their achievements ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As