Facebook
From Putrid Moth, 1 Year ago, written in Plain Text.
This paste is a reply to Calculate radius n12 from Colorant Mosquito - view diff
Embed
Download Paste or View Raw
Hits: 136
  1. project IX;
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class homework4 {
  6.  
  7.     public static void main(String[] args) {
  8.         Scanner scanner = new Scanner(System.in);
  9.        
  10.         System.out.print("Enter the radius of the circle: ");
  11.         double radius = scanner.nextDouble();
  12.        
  13.         double area = calculateArea(radius);
  14.         double circumference = calculateCircumference(radius);
  15.        
  16.         System.out.println("The area of the circle is: " + area);
  17.         System.out.println("The circumference of the circle is: " + circumference);
  18.     }
  19.    
  20.     public static double calculateArea(double radius) {
  21.         return Math.PI * radius * radius;
  22.     }
  23.    
  24.     public static double calculateCircumference(double radius) {
  25.         return 2 * Math.PI * radius;
  26.     }
  27. }
  28.  

Replies to Re: Calculate radius n12 rss

Title Name Language When
Re: Re: Calculate radius n12 Little Bee text 1 Year ago.