Write a class called square that is child class of rectangle

Assignment Help JAVA Programming
Reference no: EM131591745

Q1. Write a class called Square that is a child class of Rectangle. A square is a rectangle with equal sides. It should inherit the perimeter() and area() methods. It should also inherit the get and set methods for each attribute, if that is appropriate. The Square class should override the getType() method from the superclass so that it returns or outputs "Square."

Q2. Write a class called TestDriver that demonstrates all of the code in your Rectangle class and your Square class. The TestDriver class should do the following:
Create a Rectangle and a Square.
Go into a loop where it asks the user if they want a Rectangle or Square.
Read user answer.
If user wants to quit, then exit the program.
If user wants a Rectangle, ask user for width and length. If user wants a Square, ask user for the length of one side.
Display the type (Rectangle or Square), the length, width, area, and perimeter.
Return to Step 2.

Reference no: EM131591745

Questions Cloud

Alternative methods of selling : Give examples of each of the alternative methods of selling. Explain how you will sell the your chosen products in the chosen method.
Capital structure does not affect the risk of the debt : Assume that the change in capital structure does not affect the risk of the debt and that there are no taxes.
Compute the number of units remaining : Compute both the cost of goods available for sale and the number of units available for sale. Compute the number of units remaining in the ending inventory
Business with other cultures : 1) Describe these cultures: South/Southeast Asia, Middle-East, and Latin America.
Write a class called square that is child class of rectangle : Write a class called Square that is a child class of Rectangle. A square is a rectangle with equal sides. It should inherit the perimeter() and area() methods.
Explain the expected outcomes of the project : Describe the proposed solution (or intervention) for the problem and the way(s) in which it is consistent with current evidence.
Design a conceptual database on one of given three scenarios : Design a conceptual database on one of the three scenarios above. Example of five SQL scripts to illustrate your business rules.
Solving for rates-what annual rate of return is earned : Solving for Rates What annual rate of return is earned on a $3,400 investment when it grows to $7,300 in nine years?
Classify cash and cash equivalents : The financial statements of Marks and Spencer plc (M&S) are available at the book's companion website or can be accessed.

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