Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Write a class called Sphere that contains instance data that represents the Sphere's fadras. Define the Sphere constructer to accept and initialine the radiak,

image text in transcribed
1. Write a class called Sphere that contains instance data that represents the Sphere's fadras. Define the Sphere constructer to accept and initialine the radiak, and inclade getter and setier methods for the radius. Include methods that calculate and retara the area and volume of the Sphere. Include a toString method that returns a onc-line description of the Sphere incluafiag its tadius, area, and volume. Create a driver class called MultiSphere, whose main method instantiates three Sphere objects with different radiuses and get a fostring repoet using peintln, then you need to change the radrus of at least one object and get another repoet showing the changes. (20marks) Area=4r2tolume=34r3 2. Using the Die class defined in Chapter 4, write a class called PairOmice, eumposed of two Die objects. Include methods to set and get the individual die values, a method to roll the dies, and a method that returns the current sum of the fwo die values. Create a driver class called RellingDice? to instantiate and use a PairOfDice object. (30 Marks) [hint you need to have three classes, Die, PairOfDice and RollingDice2. the PairOfDice will use Die class and RollingDice2 which is the driver class of your program will ase PairO[Dice class] 3. 3.1. Write a program that gencrates a random double base (b) and height (b) for a triangle in the range 5 to 10 , inclasive, and then computes the area of the triangle and sbows it with three decimal points. (15 marks) 3.2. Ask the user to input a base and height for a second triangle in range of 101020 and then print the ratio of the area of the first triangle to this new triangle in percentage with correct formatting. (5 marks) What to submit: * A PDF file including pages in the following order. - (A cover page) with priat-out of - Your Name/ID, and - The statement: I have read and understood the Academic Honcsty Statcment specified in the coearse outline, and 1 have adhered fully at all time to the academic honesty rales and policies labd by the instructor, the School of Information Technology and York University Senate's Academic Inaegrity Policy. - A zipped file containing the spurce codes for questions. (Your program will be evaluated on correctness, conciseness, and neatness (readability))

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

Step: 3

blur-text-image

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

Privacy In Statistical Databases International Conference Psd 2022 Paris France September 21 23 2022 Proceedings Lncs 13463

Authors: Josep Domingo-Ferrer ,Maryline Laurent

1st Edition

3031139445, 978-3031139444

More Books

Students also viewed these Databases questions

Question

Demonstrate three aspects of assessing group performance?

Answered: 1 week ago