9/25/2012

BCS2233OOP first calculation program


1. (Computing the volume of a cylinder) Write a program that reads in the radius and length of a cylinder and computes volume using the following formulas:-
area = radius x radius x PI
volume = area x length

PI=3.14159

import java.util.Scanner;
/**
 * @(#)Welcome.java
 *
 * Welcome application
 *
 * @author
 * @version 1.00 2012/9/25
 */

public class Welcome {
 
    public static void main(String[] args) {
   Scanner input = new Scanner(System.in);
System.out.println("Enter a num for radius");
double radius = input.nextDouble();

System.out.println("Enter a num for length");
double length = input.nextDouble();


double area,volume;
        area = radius * radius * 3.14159;
        volume = area * length;

        System.out.println( volume);

    }
}

No comments:

Cara download Installer windows 10 dalam format ISO

1. Jika anda bercadang untuk download windows 10 melalui website rasmi windows - pilihan untuk download dalam format ISO tidak di berikan.  ...