Approximate the volume of cheese in a rectangular hunk

Assignment Help JAVA Programming
Reference no: EM13165847

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.

 

Reference no: EM13165847

Questions Cloud

Program to compute each semester tuition for each student : write a program to compute each semester the tuition for each student. Studient is taking 12 credit or less, tuition is 675 oer credit if student is taking more than 12 credits the total tuition is 6300.
Your city''s parking violation : Your city's Parking Violation Bureau wants you to write a program to compute fines for parking violations.
What information do you need to be able to retrieve : What information do you need to be able to retrieve every record from a hashed file in ascending key order?
Input function to prompt the user to enter a square : In the script file, use the input function to prompt the user to enter a square 2-dimensional array. Use a loop to check that user's input is a square array and repeatedly ask the user to enter a square array until they enter a square array (you m..
Approximate the volume of cheese in a rectangular hunk : 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 cyl..
Each of the conditional jump statements causes a jump to des : Assume for each part of this problem that the EAX register contains 00 00 00 4F and the doubleword referenced by value contains FF FF FF 38.
Java program that reads an input : Create a java program that reads an input of n lines with the first line being the number of people in the contest and the remaining lines a numeric 9 digit code for each person that gets a vote
Write a program in c# that creates a professorrating class : Write a program in C# that creates a ProfessorRating class consisting of professor ID and three ratings. The three ratings are used to evaluate easiness, helpfulness, and clarity.
Class named stock to model a stock : Write a class named Stock to model a stock. The properties and methods of the class are shown in Figure 6.22. The metho changePercent computes the percentage of the change in the current vs. the previous closing price.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic 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