Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Intro to programming using java, problem 9.1 The Rectangle Class, the bold is where I am getting the errors package javaapplication3; public class JavaApplication3 {

Intro to programming using java, problem 9.1 The Rectangle Class, the bold is where I am getting the errors

package javaapplication3;

public class JavaApplication3 {

/** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here //UML Class Diagram /************************************************** * Rectangle * * ------------------------------------------------* * width: double * * height: double * * Rectangle() * * Rectangle(newWidth: double, newHeight: double) * * getArea(): double * * getPerimeter(): double * ***************************************************/

double width; double height;

Rectangle() { width = 1; height = 1; }

Rectangle(double newWidth, double newHeight) { width = newWidth; height = newHeight; }

double getArea() { return width * height; }

double getPerimeter() { return 2 * (width + height); } Rectangle rectangle1 = new Rectangle(4, 40);

Rectangle rectangle2 = new Rectangle(3.5, 35.9);

System.out.println(" Rectangle 1"); System.out.println("-------------"); System.out.println("Width: " + rectangle1.width); System.out.println("Height: " + rectangle1.height); System.out.println("Area: " + rectangle1.getArea()); System.out.println("Perimeter: " + rectangle1.getPerimeter());

System.out.println(" Rectangle 2"); System.out.println("-------------"); System.out.println("Width: " + rectangle2.width); System.out.println("Height: " + rectangle2.height); System.out.println("Area: " + rectangle2.getArea()); System.out.println("Perimeter: " + rectangle2.getPerimeter()); } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Sams Teach Yourself Beginning Databases In 24 Hours

Authors: Ryan Stephens, Ron Plew

1st Edition

067232492X, 978-0672324925

More Books

Students also viewed these Databases questions

Question

Explain the chemical properties of acids with examples.

Answered: 1 week ago

Question

Write the properties of Group theory.

Answered: 1 week ago