Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Write a class called Spbere that contains instance data that roprisents the Spbere in raxin. Define the Sphere constructor to accept and initialiae the

image text in transcribed
image text in transcribed
1. Write a class called Spbere that contains instance data that roprisents the Spbere in raxin. Define the Sphere constructor to accept and initialiae the radius, and inchade gerter and seter methods for the fadius. Inclede methods that calculate and radams the circumfrrmoe and arca of the Sphere: Inclode a toSiring method that retarns a one-line description of the cirele. Creite a driver class called MuhiSphere, whese anain method instantiates and apdalss several Sphere objecti. (20marks) Area=4r2voliame=34mtr3 2. Using the Die class defased in this chapecr, write a class callod PairOPice, sen posed of two Die objects. Incqude methods to set and get the individal die valses, a method to nall the dice. and a method that rehiens the curreot num of the two die values. Create a driver clat callind. RollingDice2 to invtatiate and use a PalrOMles object. (30 Marla) [hint, yoe noed fo have thres clasics, Die, PairOftice and RellingDice2, the PairOtice: will wes Die clus an Rolling Diee 2 which is the diver class of your prognam will use Ralromiee clav]. 3. 33. Wrise n poopram that generates a radon double bese (b) and beigtr (o) fir a mange in the ange 5 an 10, incluive, and then coripuner the aren if the triaple abd sbevas it with three decimal points ( 15 maris) and ihen jeint the ratio of the area of the fint riavie si this aes ariutple pereactept with curroct formating (S marib) 1. Wriie a class called Sphere that eontaina instience data that fejtesents ibe Spberr's nafiai. Define the Sphere constructor to acscpt and initialite the tadius, and incluale getler and seter metholb for the radius. Incluak methols that calewilate and retum the circumfcrcece and ared of the Sphere: Inchade a tofaring nathod that refuras a one-line descriptioe of the cindie Crate a drivet class calliod MultiSphice, whose main method instaneiates and updutes sevent Splees oliocts. (20marks) Arrea=4r2bolume=34mr1 2. Uing the Die class defined in this chapier, wrile s clas called Pairombice, ooe posat ar ruen Dic objocts include asethods mo iet and get the indivitaal hie values, a mathod no rolit the fice, and a mothod that retyms the earnest sum of the two die values. Crmate a driver clas allet. FeniliegDiee2 to instantiate and use a FaironDice objoct (30 Merks) fhint: you socd se lane three cluses, Die, Pairombice and MolliagDice2, the PairOctice wall te Die clas and 3. 3,1. Wrice a frogram that gcecraes a nedion double hase (b) and fieyts (a) far a and shows ie wich thr decinal points. (15 nata) asd then.prine the ratio of the are of the firil triahple is tise now eriaryle =

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_2

Step: 3

blur-text-image_3

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

DB2 Universal Database V7.1 Application Development Certification Guide

Authors: Steve Sanyal, David Martineau, Kevin Gashyna, Michael Kyprianou

1st Edition

0130913677, 978-0130913678

More Books

Students also viewed these Databases questions

Question

=+ (b) Find an example in which A ,, ! A, u( A ,, ) = 00, and A = .

Answered: 1 week ago

Question

sharing of non-material benefits such as time and affection;

Answered: 1 week ago