7:29A online.claflin.eduCSCI 206 LabLab 4 - Calculating ShapesDate: 7 February 2020Due: 13 February 2020Please submit your lab on Moodle.Notes:Make sure to use variable names that make sense.Add comments to document your code. Comments are not optional and must be included.Use a one-line comment before each block to describe what you are doing – don't describe thecode syntax, but rather the purpose of the code. These comments should effectively describethe steps in your "algorithm."Spell things carefully, including capitalization, since Java is fussy about thatIndent things carefullyCheck your results! Testing your code is IMPORTANT!Create a program to calculate the perimeter and area of the following shapes.4121RightAngler = 111540Use the numbers on the sides of the shapes for your calculations.Add comments to document your code. Comments are not optional and must be included.Your output is up to you. It should be easy to read and understand and you can format it any way youlike.The output should state the following information:The perimeter of the rectangle.The area of the rectangle.o The perimeter of the triangle.The area of the triangle.The perimeter of the circle.The area of the circle.Page 1 of 1

Question
Asked Feb 14, 2020
15 views
7:29
A online.claflin.edu
CSCI 206 Lab
Lab 4 - Calculating Shapes
Date: 7 February 2020
Due: 13 February 2020
Please submit your lab on Moodle.
Notes:
Make sure to use variable names that make sense.
Add comments to document your code. Comments are not optional and must be included.
Use a one-line comment before each block to describe what you are doing – don't describe the
code syntax, but rather the purpose of the code. These comments should effectively describe
the steps in your "algorithm."
Spell things carefully, including capitalization, since Java is fussy about that
Indent things carefully
Check your results! Testing your code is IMPORTANT!
Create a program to calculate the perimeter and area of the following shapes.
41
21
Right
Angle
r = 11
15
40
Use the numbers on the sides of the shapes for your calculations.
Add comments to document your code. Comments are not optional and must be included.
Your output is up to you. It should be easy to read and understand and you can format it any way you
like.
The output should state the following information:
The perimeter of the rectangle.
The area of the rectangle.
o The perimeter of the triangle.
The area of the triangle.
The perimeter of the circle.
The area of the circle.
Page 1 of 1
help_outline

Image Transcriptionclose

7:29 A online.claflin.edu CSCI 206 Lab Lab 4 - Calculating Shapes Date: 7 February 2020 Due: 13 February 2020 Please submit your lab on Moodle. Notes: Make sure to use variable names that make sense. Add comments to document your code. Comments are not optional and must be included. Use a one-line comment before each block to describe what you are doing – don't describe the code syntax, but rather the purpose of the code. These comments should effectively describe the steps in your "algorithm." Spell things carefully, including capitalization, since Java is fussy about that Indent things carefully Check your results! Testing your code is IMPORTANT! Create a program to calculate the perimeter and area of the following shapes. 41 21 Right Angle r = 11 15 40 Use the numbers on the sides of the shapes for your calculations. Add comments to document your code. Comments are not optional and must be included. Your output is up to you. It should be easy to read and understand and you can format it any way you like. The output should state the following information: The perimeter of the rectangle. The area of the rectangle. o The perimeter of the triangle. The area of the triangle. The perimeter of the circle. The area of the circle. Page 1 of 1

fullscreen
check_circle

Expert Answer

star
star
star
star
star
1 Rating
Step 1

Programming instructions:

  • Create a class shape and calculation to initialize objects and to perform calculations respectively.
  • Create the required variables of shapes in it.
  • Create methods to calculate the areas and perimeters of shapes.
Step 2

Program:

class Calculation    //create a class for calculation of shapes
{
    void Rectangle(int x, int y)    //Create Rectangle() method to calculate the area and perimeter        
    {
        System.out.println("Area of Rectangle: " + (x*y));  //Print the area of rectangle
        System.out.println("Perimeter of Rectangle: " + 2*(x+y));   //Print the perimeter of rectangle
    }
    void Triangle(int x, int y, int z)  //Create Triangle() method to calculate the area and perimeter    
    {
        System.out.println("Area of Triangle: " +(x*y)/2);  //Print the area of Triangle
        System.out.println("Perimeter of Triangle: " + (x+y+z));    //Print the perimeter of Triangle
    }
    void Circle(double x)   //Create Circle() method to calculate the area and perimeter    
    {
        System.out.println("Area of Circle: " + (3.14*x*x));    //Print the area of Circle
        System.out.println("Perimeter of Circle: " + (2*3.14*x));   //Print the perimeter of Circle
    }
}
public class Shapes     //Create a class shape to intializ...

Want to see the full answer?

See Solution

Check out a sample Q&A here.

Want to see this answer and more?

Solutions are written by subject experts who are available 24/7. Questions are typically answered within 1 hour.*

See Solution
*Response times may vary by subject and question.
Tagged in

Engineering

Computer Science

Related Computer Science Q&A

Find answers to questions asked by student like you
Show more Q&A
add
question_answer

Q: 9. Implement an array with values 1, 5, 14, 23, 45, 52, 58, 81, 82 91. a) Create a getindex( functio...

A: Solving the given problem by using C++, as no programming language is specified.   The below given C...

question_answer

Q: You have been asked to assess the success of a recently implemented system that has been deployed ac...

A: The Supply chain information system manages and helps in determining the supplies that are needed fo...

question_answer

Q: Describe the bull’s-eye model. What does it say about policy in the information securityprogram? Dis...

A: Click to see the answer

question_answer

Q: :Normalization Topic What is BCNF? Please, give example.

A: 3NF: It is used to normalize a database (reduce redundancy and dependency). Larger tables are divide...

question_answer

Q: Can you help me solve this and explain it step by step on how the answer was found please. Given int...

A: The function at(i) returns the reference of the element at position i in the vector. Hence, if the v...

question_answer

Q: Create a complex query based on two or more tables (SCHOOL, DEPARTMENT, PROFESSOR, TECHNOLOGY, COURS...

A: Query:SELECT DEPARTMENT.DEPARTMENT_NAME, DEPARTMENT.DEPARTMENT_ID,SCHOOL.SCHOOL_CODE,COURSE.COURSE_T...

question_answer

Q: Convert the following: 40 base 8 to base 7 34 base 6 to base 3

A: Click to see the answer

question_answer

Q: TestCircle• Create a Circle with the radius• Print the radius using the getters• Print the Circle’s ...

A: The given criteria is written in Java programming language.

question_answer

Q: In java Define and create an array of 10 integers. The array elements should be initialized to zero.

A: Array in java: An array is a set of like-typed variables, to which a common name refers. Java array...