ComputerScienceExpert

(11)

$18/per page/

About ComputerScienceExpert

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Applied Sciences,Calculus See all
Applied Sciences,Calculus,Chemistry,Computer Science,Environmental science,Information Systems,Science Hide all
Teaching Since: Apr 2017
Last Sign in: 103 Weeks Ago, 3 Days Ago
Questions Answered: 4870
Tutorials Posted: 4863

Education

  • MBA IT, Mater in Science and Technology
    Devry
    Jul-1996 - Jul-2000

Experience

  • Professor
    Devry University
    Mar-2010 - Oct-2016

Category > Programming Posted 06 May 2017 My Price 9.00

Modify your solution for to allow the user to choose the shape

JAVA CODE HELP PLEAAAASSSSSEEE lol 

My code attached, just need some help. 

 

 Modify your solution for to allow the user to choose the shape to compute and report. The change should make the "look and feel" of the program cleaner and the user experience less cumbersome. There are several selection structure implementations (if-else, switch) that can be used in the solution. The user should be provided with a "menu of choices" that will allow them to identify the shape they wish to work with. A typical session might look like this:


Choose the shape
1. Square
2. Rectangle
3. Circle
4. Triangle
5. Quit
Enter your choice: 1

Enter the side (as a decimal): 10.5
The area is 110.25
The perimeter is: 42.0

 

 

 

MY CODE: 

//********************************************************
// The program calculates the area of a rectangle
// based on values entered by the user.
//********************************************************


import java.util.Scanner;

public class Rectangle Area {

public static void main(String[] args) {
// TODO Auto-generated method stub

double side1 = 0.0;
double side2 = 0.0;
double radius = 0.0;
double base = 0.0;
double height = 0.0;
final double PI = 3.14159;

System.out.println("Enter the first side ");
Scanner inData; // A class that reads input
inData = new Scanner(System.in);

System.out.println("Enter the length of a side ");
side1 = inData.nextDouble();

System.out.println("Enter the length of second side ");
side2 = inData.nextDouble();

System.out.println("The area is " + side1 * side2);
System.out.println("The perimeter is " + 2 * (side1 + side2));
System.out.print("Enter the radius: ");
radius = inData.nextDouble();

double area11 = PI * radius * radius; //calculating area of circle
double peri1 = PI * radius * 2.0; //calculating perimeter of rectangle

System.out.println("The area is: " + area11);
System.out.println("The circumference is: " + peri1);
System.out.print("Enter the height of the triangle: ");
height = inData.nextDouble();
System.out.print("Enter the base of the triangle: ");
base = inData.nextDouble();

double area111 = (1.0 / 2.0) * base * height; //calculating area of triangle
double peri11 = Math.sqrt((height * height) + (base * base)) + height + base; //calculating perimeter of triangle

System.out.println("The area is: " + area111);
System.out.println("The perimeter is : " + peri11);


}
}


Answers

(11)
Status NEW Posted 06 May 2017 04:05 AM My Price 9.00

-----------

Attachments

file 1494046111-Solutions file 2.docx preview (51 words )
H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly -----------onl-----------ine----------- an-----------d g-----------ive----------- yo-----------u e-----------xac-----------t f-----------ile----------- an-----------d t-----------he -----------sam-----------e f-----------ile----------- is----------- al-----------so -----------sen-----------t t-----------o y-----------our----------- em-----------ail----------- th-----------at -----------is -----------reg-----------ist-----------ere-----------d o-----------n -----------THI-----------S W-----------EBS-----------ITE-----------. ----------- Th-----------ank----------- yo-----------u -----------
Not Rated(0)