SophiaPretty

(5)

$14/per page/Negotiable

About SophiaPretty

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

Expertise:
Accounting,Algebra See all
Accounting,Algebra,Applied Sciences,Architecture and Design,Art & Design,Biology,Business & Finance,Calculus,Chemistry,Communications,Computer Science,Economics,Engineering,English,Environmental science,Essay writing Hide all
Teaching Since: Jul 2017
Last Sign in: 304 Weeks Ago, 1 Day Ago
Questions Answered: 15833
Tutorials Posted: 15827

Education

  • MBA,PHD, Juris Doctor
    Strayer,Devery,Harvard University
    Mar-1995 - Mar-2002

Experience

  • Manager Planning
    WalMart
    Mar-2001 - Feb-2009

Category > Computer Science Posted 08 Jan 2018 My Price 7.00

attribute to a value which is passed to the constructor.

Square:

a) Write a class to represent a Square. This should include the following:

i). A single attribute named length

ii). A default constructor which should set the length attribute to a default value of 1.

iii). A second constructor which should set the length attribute to a value which is passed to the constructor.

iv). Getter and setter methods for the length attribute.

v). A method, called getArea(), to calculate and return the area of the Square.

vi). A method called toString() that returns the value of the attribute length (see sample output below for format) 

 

b) Write a main method in a new class called TestSquare and in this method:

i). Create an array containing 4 square objects.

ii). Use a ‘for’ loop to set each object to default values when created.

iii). Use the setter method on the 1st and 3rd objects in the array of Square objects to set the length to 10.

iv). Print out the length of each of Square object in the array.

v). Print out the area of the 1st and 2nd objects in the array.

vi). Call the toString() method on the 3rd  Square object in the array. 

 

Answers

(5)
Status NEW Posted 08 Jan 2018 02:01 PM My Price 7.00

-----------  ----------- 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

Not Rated(0)