Saturday, August 19, 2017

Area of the Circle Solve Using Scala

In this article I wrote a program using Scala to ask the user to give the radius of the circle and then our program will compute the area of the circle. I wrote the code using Scala as my programming language and IntelliJ IDEA text editor community edition which is FREE to download and use over the Internet. I hope you will find my work useful. Thank you.

I hope you will find my work useful and beneficial. If you have some questions about programming, about my work please send mu an email at jakerpomperada@gmail.comand jakerpomperada@yahoo.com. People here in the Philippines can contact me at  my mobile number 09173084360.

Thank you very much and Happy Programming.



My text editor use in making this program





Sample Program Output



Program Listing

// Written By: Mr. Jake R. Pomperada, MAED-IT
// Tool : Scala
// IDE  : IntelliJ IDEA Community Version 2017.2
// Date : August 19, 2017   Saturday
// Country : Philippines


import java.util.Scanner;

object AreaCircle2 {

  def main(args: Array[String]) {

    var input = new Scanner(System.in);

    print("\n\n");
    print("Area of the Circle Solve Using Scala");
    print("\n\n");
    print("Written By: Mr. Jake R. Pomperada, MAED-IT");
    print("\n\n");
    print("Enter the Radius of the Circle : ");

    var radius = input.nextDouble();


    var area = 3.14 * radius * radius

    print("\n\n");
    print("The Area of Circle is " + f"$area%2.2f" )
    print("\n\n");
    print("\t END OF PROGRAM");
    print("\n\n");
  }
}




No comments:

Post a Comment