Question

Create a package named Q2 for your program. • Give your java class an appropriate name. • The program will • The user must be asked to enter the height and radius for the cone they wish to compute the volume for. • The program will then output the volume of the cone up to two decimal places using the printf() method. The volume of a cone is given by "#!$, where r is the radius of the base of in the sample output. print the header information with a brief description of the task as shown the cone and h is the height of the cone. Hint: Sample Output: **************************************************** Full Name: Student Number: Date: % Instead of declaring a variable (or final identifier) PI and initialize it with a value 3.14159265, you can use Math.PI field in the volume expression; In Math class, the filed PI (upper case P and I) has been declared as a public static final double type data field.

          Create a package named Q2 for your program.
• Give your java class an appropriate name.
• The program will
• The user must be asked to enter the height and radius for the cone they wish to compute the volume for.
• The program will then output the volume of the cone up to two decimal places using the printf() method. The volume of a cone is given by "#!$, where r is the radius of the base of
in the sample output.
print the header information with a brief description of the task as shown
the cone and h is the height of the cone. Hint:
Sample Output:
**************************************************** Full Name:
Student Number:
Date:
%
Instead of declaring a variable (or final identifier) PI and initialize it with a value
3.14159265, you can use Math.PI field in the volume expression; In Math class, the filed PI
(upper case P and I) has been declared as a public static final double type data field.
        
Show more…

Added by Luc-A E.

Computer Science and Information Technology
Computer Science and Information Technology
Trishna Knowledge Systems 2018 Edition
AceChat toggle button
Close icon
Ace pointing down

Please give Ace some feedback

Your feedback will help us improve your experience

Thumb up icon Thumb down icon
Thanks for your feedback!
Profile picture
Create a package named Q2 for your program. • Give your java class an appropriate name. • The program will • The user must be asked to enter the height and radius for the cone they wish to compute the volume for. • The program will then output the volume of the cone up to two decimal places using the printf() method. The volume of a cone is given by "#!$, where r is the radius of the base of in the sample output. print the header information with a brief description of the task as shown the cone and h is the height of the cone. Hint: Sample Output: **************************************************** Full Name: Student Number: Date: % Instead of declaring a variable (or final identifier) PI and initialize it with a value 3.14159265, you can use Math.PI field in the volume expression; In Math class, the filed PI (upper case P and I) has been declared as a public static final double type data field.
Close icon
Play audio
Feedback
Powered by NumerAI
Danielle Fairburn David Collins
Jennifer Stoner verified

Akash M and 59 other subject AP CS educators are ready to help you.

Ask a new question

*

Labs

-

Want to see this concept in action?

NEW

Explore this concept interactively to see how it behaves as you change inputs.

View Labs

*

Key Concepts

-
Key Concept
Premium Feature
Explore the core concept behind this problem.
Play button
Key Concept
Premium Feature
Explore the core concept behind this problem.
Your browser does not support the video tag.

*

Recommended Videos

-
please-use-python-thanks-cylinder-write-a-program-that-calculates-the-volume-of-a-cylinder-your-program-will-get-the-radius-of-the-cylinders-base-r-and-the-height-of-the-cylinder-h-as-comman-21376

Cylinder Write a program that calculates the volume of a cylinder. Your program will get the radius of the cylinder's base r and the height of the cylinder h as command line arguments. The radius will be given first. Your program may encounter these unusual situations: If the program receives less than two arguments, print the message "Not enough arguments." If the program receives more than two arguments, print the message "Too many arguments." If the radius is negative, print the message "Radius cannot be negative." If the height is negative (but the radius is non-negative), print the message "Height cannot be negative." For all situations listed above, the program should terminate immediately after the message has been printed. The value of pi should be set as a constant with the value 3.141592. The volume of the cylinder should be printed to 2 decimal places and can be calculated using the formula: V = πr^2h Example 1: $ python cylinder.py 4 10 The volume of the cylinder is 502.65.

Akash M.

6-write-the-pseudocode-syntax-just-the-steps-you-need-to-perform-that-will-declare-2-floats-for-the-radius-and-height-of-a-cylinder-and-output-the-volume-of-the-cylinder-volume-of-a-cylinder-53132

Akash M.

c-write-programs-for-the-following-vs17-express-consider-the-following-program-in-which-the-statements-are-in-the-incorrect-order-rearrange-the-statements-so-that-the-program-prompts-the-use-32076

(C++) Write programs for the following (VS17 Express) Consider the following program in which the statements are in the incorrect order: Rearrange the statements so that the program prompts the user to input the height and the radius of the base of a cylinder and outputs the volume and surface area of the cylinder. Format the output to two decimal places. #include <iostream> #include <iomanip> #include <cmath> const double PI = 3.14159; int main() { double height, radius; cout << "Enter the height of the cylinder: "; cin >> height; cout << endl; cout << "Enter the radius of the base of the cylinder: "; cin >> radius; cout << endl; cout << fixed << showpoint << setprecision(2); cout << "Volume of the cylinder = " << PI * pow(radius, 2.0) * height << endl; cout << "Surface area: " << 2 * PI * radius * height + 2 * PI * pow(radius, 2.0) << endl; return 0; }

Akash M.


*

Recommended Textbooks

-
Computer Science and Information Technology

Computer Science and Information Technology

Trishna Knowledge Systems 2018 Edition
achievement 1,922 solutions
Introduction to Programming Using Python

Introduction to Programming Using Python

Y. Daniel Liang 1st Edition
achievement 1,325 solutions
Computer Science - An Overview

Computer Science - An Overview

Glenn Brookshear, Dennis Brylow 12th Edition
achievement 1,696 solutions

*

Transcript

-
00:01 Hello, here we are with answers to the given question.
00:02 Let's start the discussion.
00:04 In this context, we are asked to write the program, write program and this program will involve certain steps.
00:15 You have to check the number of command and you require to face the command.
00:28 This is something that you consider by going for the command line and you have to check whether the radius is negative radius negative and you have to also check whether the height is negative.
00:46 Once we go for this, we can print the volume.
00:51 Okay, so let's consider the command to be considered it would be print dot sys elif len sys dot argu then you go for re equal to float and h equal to float float and this would be print hyphen radius...
Need help? Use Ace
Ace is your personal tutor. It breaks down any question with clear steps so you can learn.
Start Using Ace
Ace is your personal tutor for learning
Step-by-step explanations
Instant summaries
Summarize YouTube videos
Understand textbook images or PDFs
Study tools like quizzes and flashcards
Listen to your notes as a podcast
Continue solving this problem
Create a free account to:
  • View full step-by-step solution
  • Ask follow-up questions with Ace AI
  • Save progress and study later
Continue Free
Join the community

18,000,000+

Students on Numerade


Trusted by students at 8,000+ universities

Numerade

Get step-by-step video solution
from top educators

Continue with Clever
or



By creating an account, you agree to the Terms of Service and Privacy Policy
Already have an account? Log In

A free answer
just for you

Watch the video solution with this free unlock.

Numerade

Log in to watch this video
...and 100,000,000 more!


EMAIL

PASSWORD

OR
Continue with Clever