URI Problem (Area) 1012 Solution in Java

Problem Solving, URI

URI Problem (Area) 1012:
Area is a basic problem on URI online judge for novice problem solver.
You can find details on this Link.

import java.util.Scanner;

/**
 * @Author : Muhammad Harun-Or-Roshid
 * @Date   : Oct 6, 2016
 * @Time   : 8:38:17 PM
 */
public class Uri1012 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        double A,B,C;
        A = sc.nextDouble();
        B = sc.nextDouble();
        C = sc.nextDouble();
        //a) the area of the rectangled triangle that has base A and height C.
        double area_triangle = 0.5f*A*C;
        //b) the area of the radius's circle C. (pi = 3.14159) 
        double area_radius = 3.14159*C*C;
        //c) the area of the trapezium which has A and B by base, and C by height.
        double area_trapezium = ((A+B)/2)*C;
        //d) the area of ​​the square that has side B.
        double area_square = B*B;
        //e) the area of the rectangle that has sides A and B.
        double area_rectangle = A*B;
        
        System.out.printf("TRIANGULO: %.3f\n",area_triangle);
        System.out.printf("CIRCULO: %.3f\n",area_radius);
        System.out.printf("TRAPEZIO: %.3f\n",area_trapezium);
        System.out.printf("QUADRADO: %.3f\n",area_square);
        System.out.printf("RETANGULO: %.3f\n",area_rectangle);
    }
}

0 Comments

You may find interest following article

Complete Guide: Create Laravel Project in Docker Without Local Dependencies

Create Laravel Project Through Docker — No Need to Install PHP, MySQL, or Apache on Your Local Machine In this tutorial, I’ll show you how to create and run a full Laravel project using Docker containers. That means you won’t have to install PHP, MySQL, or Apache locally on your computer. By the end of this guide, you’ll have a fully functional Laravel development...