I have some words underlined that are important to understan

I have some words underlined that are important to understand their terms. Write a program that declares the following: a String variable called first Name a String variable called last Name an int variable called year Of Graduation a double variable called radius a double variable called area a final double constant called? The program should include a Multi-line comment at top of the Java file with the following information: Author name of author File Name: name of the java file Description: description of what the program does Use literals to store: your first name into a variable called first Name your last name into a variable called last Name your year of graduation into a variable called year Of Graduation the radius of a circle you want to calculate into a variable called radiu3 Define the following constant: Declare and unitize a constant called PI to be 3.1415 Assign diameter by calculating the area of the circle using formula: diameter = radius * radius Assign area by calculating the area of the circle using formula: area = PI * diameter Add System, out. println statements to your program to print the following to the console the output is to look exactly as described below. Note the spacing and alignment. Make sure your output is formatted exactly as follows: First/Last Name: Major: Graduation Year: Circle Radius: Circle Diameter: Circle Area: Example output: First/Last Name: John Smith Major: Education Graduation Year: 2019 Circle Radius: 5.5 Circle Diameter: 11.0 Circle Area: 34.5565

Solution

Circle.java

/*
* Name:
* Filename:Class.java
* Description: This program will calculate the Area of the circle.
*/

import java.util.Scanner;

public class Circle {


   public static void main(String[] args) {
       //Scanner object is used to get the inputs entered by the user
               Scanner sc=new Scanner(System.in);
              
               //Declaring vsriables
               String firstname;
               String lastname;
               int yearOfGraduation;
               double radius;
               double area;
              
               //Declaring constant
               final double PI=3.1415;
              
               //Getting the first name entered by the user
               System.out.print(\"Enter the Firstname :\");
               firstname=sc.next();

               //Getting the last name entered by the user
               System.out.print(\"Enter the Lastname :\");
               lastname=sc.next();
              
               //Getting the Year of Graduation entered by the user
               System.out.print(\"Enter Year of Graduation :\");
               yearOfGraduation=sc.nextInt();

               //Getting the radius entered by the user
               System.out.print(\"Enter the Radius :\");
               radius=sc.nextDouble();
              
              
               //calculating the area of the circle
               area=PI*radius*radius;
              
               //displaying the output
               System.out.println(\"\ First/Last Name :\"+firstname+\" \"+lastname);
               System.out.println(\"Graduation Year :\"+yearOfGraduation);
               System.out.println(\"Circle Radius :\"+radius);
               System.out.println(\"Circle Diameter :\"+2*radius);
               System.out.printf(\"Circle Area : %.2f\",area);
              

   }

}

____________________

output:

Enter the Firstname :John
Enter the Lastname :Smith
Enter Year of Graduation :2019
Enter the Radius :5.5

First/Last Name :John Smith
Graduation Year :2019
Circle Radius :5.5
Circle Diameter :11.0
Circle Area : 95.03

___________Thank You

 I have some words underlined that are important to understand their terms. Write a program that declares the following: a String variable called first Name a S
 I have some words underlined that are important to understand their terms. Write a program that declares the following: a String variable called first Name a S

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site