Question

Design the Xamarin Android Program to find the Volume of a Cylinder Volume of Cylinder =...

Design the Xamarin Android Program to find the Volume of a Cylinder

Volume of Cylinder = 3.14 * radius*radius*height;

Display the output using a dialog box. Provide the input validation to accept numbers only

File coding is one should be xml file and another one is C# file for coding

Android coding

0 0
Add a comment Improve this question Transcribed image text
Answer #1

VolumeOfCylinder.java
import java.util. Scanner;

import javax.swing.JOptionPane;

public class VolumeOfCylinder {

public static void main(String[] args) {
//Scanner class object to get input from user
Scanner input=new Scanner(System.in);
System.out.print("Enter radius of cylinder: ");
// get radius of cylinder from user
double radius=input.nextDouble();
// validating radius
if(radius<0)
System.exit(0);
System.out.print("Enter height of cylinder: ");
// get height of cylinder from user
double height=input.nextDouble();
//validating height
if(height<0)
System.exit(0);
//calculate volume of cylinder
double volume=3.14* radius*radius* height;
//display answer using dialog box
System.out.println("\nVolume of cylinder is"+volume);
JOptionPane.showMessageDialog(null, "Volume of cylinder is "+volume);
input.close(); // close Scanner object
}
}
Output
Enter radius of cylinder:5
Enter height of cylinder:3

volume of cylinder is 235.5


Add a comment
Know the answer?
Add Answer to:
Design the Xamarin Android Program to find the Volume of a Cylinder Volume of Cylinder =...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a program using the class to find out the area of a circle and volume...

    Write a program using the class to find out the area of a circle and volume of a cylinder. [* area of a circle=πr2, the volume of a cylinder=πr2*h where h is the height of the cylinder and r is the radius of the circular end of the cylinder] 1. The member variable should be private 2. Use public member functions to execute your program. 3. Use set ( ) function to access the private members 4. Use another approach...

  • Need help with these scenarios Question 1 Write a JavaScript program to get the volume of...

    Need help with these scenarios Question 1 Write a JavaScript program to get the volume of a Cylinder with four decimal places using object classes. Volume of a cylinder : V = πr2h where r is the radius and h is the height of the cylinder. Your solution must include an HTML and a JavaScript file, with a button to create the cylinder, inputs for the cylinder's radius and height and an output to show the cyclinder's volume. Your solution...

  • Question 4 Write a program that display the area of a triangle. The program calls the...

    Question 4 Write a program that display the area of a triangle. The program calls the following two functions: .getBaseHeight - This function uses a reference parameter variables to accept a double arguments base and height. This function should ask the user to enter the triangle's buse and height. Input validation: base and height should be positive numbers. calArea - This function should accept the triangle's base and height as arguments and return the triangle's area. The area is calculated...

  • 1. Write a program that determines the area and perimeter of a square. Your program should...

    1. Write a program that determines the area and perimeter of a square. Your program should accept the appropriate measurement of the square as input from the user and display the result to the screen. Area of Square = L (squared) Perimeter of Square = 4 * L 2.  Write a program that determines the area and circumference of a circle. Your program should accept the appropriate measurement of the circle as input from the user and display the result to...

  • Write a C program named assignment04.cpp that will ask for and read in a float for...

    Write a C program named assignment04.cpp that will ask for and read in a float for a radius ask for and read in a float for the height each of the following functions will calculate some property of a shape (area, volume, circumference, etc) The functions will accept one or two parameters (radius and/or height) and return the proper calculation. There is no input/output (cin or cout) in the function – just the calculation write the following functions float areaCircle(float...

  • For the scenario below, use the model for the volume of a cylinder as V =...

    For the scenario below, use the model for the volume of a cylinder as V = 3.14(r^2)(h) D. About 7 days E. There is not enough information to solve the problem. 58. For the scenario below, use the model for the volume of a cylinder as V = ?h. Pringles wants to add 21 percent more chips to their cylinder cans and minimize the design change of their cans. They've decided that the best way to minimize the design change...

  • (PYTHON) Write a program that displays the following menu:. , Write Algorithm for Code Geometry Calculator...

    (PYTHON) Write a program that displays the following menu:. , Write Algorithm for Code Geometry Calculator 1. Calculate the Area of a Circle 2. Calculate the Area of a Rectangle 3. Calculate the Area of a Triangle 4. Quit Enter your choice (1 - 4): If the user enters 1, the program should ask for the radius of the circle and then display its area. If the user enters 2, the program should ask for the length and width of...

  • please write in C++ Write a program that uses a structure to store the following inventory...

    please write in C++ Write a program that uses a structure to store the following inventory data in a file: The data can be either read from a text file or the keyboard Item name (string) Quantity on hand(int) Wholesale cost(double) Retail Cost(double) The program should have a menu that allows the user to perform the following tasks: Add new records to the file Display any record in the file User will provide the name of the item or the...

  • Python 3.7 Coding assignment This Program should first tell users that this is a word analysis...

    Python 3.7 Coding assignment This Program should first tell users that this is a word analysis software. For any user-given text file, the program will read, analyze, and write each word with the line numbers where the word is found in an output file. A word may appear in multiple lines. A word shows more than once at a line, the line number will be only recorded one time. Ask a user to enter the name of a text file....

  • Write a C program Design a program that uses an array to store 10 randomly generated...

    Write a C program Design a program that uses an array to store 10 randomly generated integer numbers in the range from 1 to 50. The program should first generate random numbers and save these numbers into the array. It will then provide the following menu options to the user: Display 10 random numbers stored in the array Compute and display the largest number in the array Compute and display the average value of all numbers Exit The options 2...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT