Alpha Geek

(8)

$10/per page/Negotiable

About Alpha Geek

Levels Tought:
University

Expertise:
Accounting,Algebra See all
Accounting,Algebra,Architecture and Design,Art & Design,Biology,Business & Finance,Calculus,Chemistry,Communications,Computer Science,Environmental science,Essay writing,Programming,Social Science,Statistics Hide all
Teaching Since: Apr 2017
Last Sign in: 438 Weeks Ago, 2 Days Ago
Questions Answered: 9562
Tutorials Posted: 9559

Education

  • bachelor in business administration
    Polytechnic State University Sanluis
    Jan-2006 - Nov-2010

  • CPA
    Polytechnic State University
    Jan-2012 - Nov-2016

Experience

  • Professor
    Harvard Square Academy (HS2)
    Mar-2012 - Present

Category > Programming Posted 20 Jun 2017 My Price 7.00

Create a class named Circle with fields named radius, diameter, and area

a. Create a class named Circle with fields named radius, diameter, and area. Include a constructor that sets the radius to 1 and calculates the other two values. Also include methods named setRadius()and getRadius(). The setRadius() method not only sets the radius but also calculates the other two values. (The diameter of a circle is twice the radius, and the area of a circle is pi multiplied by the square of the radius. Use the Math class PI constant for this calculation.) Save the class as Circle.java.

b. Create a class named TestCircle whose main() method declares several Circle objects. Using the setRadius() method, assign one Circle a small radius value, and assign another a larger radius value. Do not assign a value to the radius of the third circle; instead, retain the value assigned at construction. Display all the values for all the Circle objects. Save the application as TestCircle.java.

 

Answers

(8)
Status NEW Posted 20 Jun 2017 12:06 PM My Price 7.00

-----------

Attachments

file 1497961561-Answer.docx preview (149 words )
p-----------ubl-----------ic -----------cla-----------ss -----------Cir-----------cle-----------{ ----------- ----------- -----------pri-----------vat-----------e d-----------oub-----------le -----------rad-----------ius-----------; ----------- d-----------oub-----------le -----------dia-----------met-----------er,-----------are-----------a; ----------- -----------Cir-----------cle-----------(){----------- ----------- -----------rad-----------ius-----------=1;----------- ----------- -----------dia-----------met-----------er=-----------2*r-----------adi-----------us;----------- ----------- -----------are-----------a=M-----------ath-----------.PI-----------*ra-----------diu-----------s*r-----------adi-----------us;----------- ----------- } ----------- ----------- ----------- vo-----------id -----------set-----------Rad-----------ius-----------(do-----------ubl-----------e r-----------){ ----------- ra-----------diu-----------s=r-----------; ----------- ----------- di-----------ame-----------ter-----------=2*-----------rad-----------ius-----------; ----------- ----------- ar-----------ea=-----------Mat-----------h.P-----------I*r-----------adi-----------us*-----------rad-----------ius-----------; ----------- }----------- ----------- do-----------ubl-----------e g-----------etR-----------adi-----------us(-----------){ ----------- ----------- r-----------etu-----------rn -----------rad-----------ius-----------; ----------- }----------- }----------- p-----------ubl-----------ic -----------cla-----------ss -----------Tes-----------tCi-----------rcl-----------e{ ----------- -----------pub-----------lic----------- st-----------ati-----------c v-----------oid----------- ma-----------in(-----------Str-----------ing-----------[] -----------arg-----------s){----------- ----------- -----------Cir-----------cle----------- ob-----------1=n-----------ew -----------Cir-----------cle-----------();----------- ----------- -----------Cir-----------cle----------- ob-----------2=n-----------ew
Not Rated(0)