Anti Essays offers essay examples to help students with their essay writing.

Sign Up

Java Area Program Essay

  • Submitted by: anonymous
  • on February 19, 2014
  • Category: Miscellaneous
  • Length: 498 words

Open Document

Below is an essay on "Java Area Program" from Anti Essays, your source for research papers, essays, and term paper examples.

package Package2;
import java.util.*;

Tucker Hagen
CSIS 161 Programming
Section: 01
Professor: Abuhejleh
Meets: M-W-F 11:00-11:50

public class Class2 {
This program calculates the area of many math shapes including Circles, Squares, Rectangles, and Triangle.

static Scanner console = new Scanner(System.in);
public static void main(String[] args){
int length; //variable to store the user input for length.
int width; // variable to store the user input for width.
int side;//variable to store the user input for the square's side length.
double base;// variable to store the user input for base.
double height;//variable to store the user input for height.
double radius;//variable to store the user input for radius.

//explains program to user
System.out.println("This program will find the Area of a square, rectangle, circle, and triangle.");

System.out.println("Area of a Rectangle");
//ask user for a length
System.out.print("Please enter an integer for the length of the of a rectangle:");
length = console.nextInt();//sets variable for length

//ask user for width
System.out.print("Please enter an integer value for the width:");
width = console.nextInt();//sets variable for width

//outputs answer for rectangle
System.out.println("A rectangle with width of " +width+ " and a length of " +length+ " has an area of " +width * +length); //calculates the area of the rectangle using integers length times width.

System.out.println("Area of a Square");

//asks user for side length

System.out.print("Please enter an an integer for the side length of the square:");
side = console.nextInt();//sets variable for side...

Show More


MLA Citation

"Java Area Program". Anti Essays. 11 Dec. 2018


APA Citation

Java Area Program. Anti Essays. Retrieved December 11, 2018, from the World Wide Web: http://teachingsail.com/free-essays/Java-Area-Program-583675.html

Watch Running Wild with Bear Grylls | photoshop | Networking