Write a test program that creates two rectangle objects

Assignment Help JAVA Programming
Reference no: EM132076104

I need help with a Java exercise. I am in Introduction to Programming using Java by Daniel Liang so it is known what example this is talking about. Hopefully that helps. Please make this as basic and simple as possible. Thank you.

Problem 1: 9.1 (The Rectangle Class) pg. 360 in the textbook

Following the example of the Circle class in Section 9.2, design a class named Rectangle to represent a rectangle. The class contains:

¦ Two double data fields named width and height that specify the width and height of the rectangle. The default values are 1 for both width and height.

¦ A no-arg constructor that creates a default rectangle.

¦ A constructor that creates a rectangle with the specified width and height.

¦ A method named getArea() that returns the area of this rectangle.

¦ A method named getPerimeter() that returns the perimeter.

Draw the UML diagram (using Word or some other editor) for the class and then implement the class.

Write a test program that creates two Rectangle objects-one with width 4 and height 40 and the other with width 3.5 and height 35.9. Display the width, height, area, and perimeter of each rectangle in this order.

Reference no: EM132076104

Questions Cloud

Write the equation of the tangent lines : The graph of x^2 + y^2 =100 is a circle having center at the origin and radius 10.
Find the number of units that should be sold : A) Find the number of units that should be sold in order to maximize the total profit. B) What is the maximum profit?
To practice more with collections and exceptions : These students do not have an ID, but they do have a phone number. Two students are the same if they have the same name and phone number.
Combined surface area of all six sides of the box : A box has a square base of side length x meters and height h meters. The volume of the box is V(h,x) and S(h,x) is the combined surface area of all six sides
Write a test program that creates two rectangle objects : Write a test program that creates two Rectangle objects-one with width 4 and height 40 and the other with width 3.5 and height 35.9.
Write a constructor for the dictionary class : Write a constructor for the Dictionary class. The constructor should initialize the instance data variables using parameters.
What are the values of a and b : A given curve in the family x2 + xy + ay2 = b has a tangent line at point (1, 3) with slope -5/14. What are the values of a and b?
Determine the position and velocity functions for the coin : A. Determine the position and velocity functions for the coin. B. Determine the average velocity of the coin on the interval [1, 3].
How many hours would it take for the object to travel 140 : How many hours would it take for the object to travel 140 miles?

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd