Create an object with a radius

Assignment Help Basic Computer Science
Reference no: EM131955181

Make a class named Cylinder with a field for the radius and a field for the height. Be sure to include the following:

  • a default constructor that sets the radius to 3 and height to 8
  • a setter function to set the value of the radius
  • a setter function to set the value of the height
  • a getter function to return the value of the radius
  • a getter function to return the value of the height
  • a function to compute and return the cylinder's surface area

Be aware that the surface area of a cylinder is 2 * pi * radius * radius + 2 * pi * radius * height. Feel free to use the value of 3.14 for pi.

Next, provide an appropriate main function (driver code) to test this class. Create an object with a radius of 10. Make a second Cylinder object that uses the radius set by the default constructor. Once the objects have been created, add code to change the values of the first Cylinder object and display the surface area of both cylinders in an attractive fashion.

Sample Session:

Please enter the radius: 5

Please enter the height: 8

The cylinder with a radius of 3 and height of 8 has a surface area of:  207.24

The cylinder with a radius of 5 and height of 8 has a surface area of:  408.20

Reference no: EM131955181

Questions Cloud

Field for the radius and a field for the height : Make a class named Cylinder with a field for the radius and a field for the height. Be sure to include the following:
Develop a business proposal persuading the senior management : Develop a business proposal persuading the senior management of your organization to initiate a change in processes, procedures.
Important aspects of your savings-retirement planning : The time vale of money and compounding are important aspects of your savings/retirement planning.
Professional conduct for forensic computer examiners : What is the official organization that dictates codes of professional conduct for forensic computer examiners?
Create an object with a radius : Next, provide an appropriate main function (driver code) to test this class. Create an object with a radius of 10. Make a second Cylinder object
Describe the organization and the issue to resolve : How has the current corporate culture facilitated the development of the current issue?Describe the Organization and the Issue to Resolve .
Retrospective view of fords field recall coordinator : Retrospective view of Fords field recall coordinator
What are the relevant legal rules relating to this problem : LAW00150 Introduction to Business Law Assignment - LEGAL PROBLEMS. What are the relevant legal rules relating to this problem
Describe two types of pure risk : Describe two types of pure risk for which the technique of risk pooling can be used to reduce risk effectively,

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Different types of switching used in data transmission

Compare or contrast the different types of switching used in data transmission. How many are there? What factors separate one from the other? Please elaborate.

  Rewrite the add place mark () and make style node ()

That is, construct the place marks by pasting strings together, and then convert the strings into XML nodes with a call to xml Parse And Add ().

  If each digit may be used once in each number

How many four-digit numbers can be formed from the digits 1, 3, 5, 7, 8, and 9 (a) if each digit may be used once in each number?

  Devise an iterative method of generating valid configuration

The objective is to find a tour (i.e., permutation of the order in which the cities are visited) that is of minimal total length L. In this problem, the different possible tours are the configurations, and the total length of a tour is the cost fu..

  Design a class message that models an email message

Design a class Message that models an email message. A message has a recipient, a sender , and a message text. Support the following methods:

  At what drain current are these two equal

For power-conscious applications, a figure of merit is defined as the transconductance of devices normalized to their bias current. Determine this quantity for long-channel devices operating in strong inversion or the subthreshold region. At what ..

  List out the various steps of software life cycle

Que.1: List out the various steps of Software Life Cycle. Draw the diagram of Software Life Cycle and explain all the steps in details. Que.2: What is the importance of Team Work? Draw the Team Responsibility Diagram as well as Draw the diagram of..

  Provide future of mimo

What is MIMO? What's the history? What issues are addressed? What are the goals? Identify all advantages and disadvantages of MIMO.

  Return array contains the exact same numbers as given array

Return an array that contains the exact same numbers as the given array, but rearranged so that all the even numbers come before all the odd numbers. Other than that, the numbers can be in any order.

  Logical expression

write a short paper on what your program does. Include the logical expression and what type of while loop (EOF, sentinel-controlled, counter-controlled, flag-controlled) you need. Using the same logical expression as above, use a different while l..

  Multimedia can be difficult to view on a mobile device

Some multimedia can be difficult to view on a mobile device due to screen size or bandwidth limitations. Find two articles that discuss considerations and new developments that will enable multimedia on a site to be viewed effectively on a mobile dev..

  Draw a level 0 data flow diagram

Draw a level 0 data flow diagram (DFD) for the accompanying dentist office system. When new patients are seen for the first time, they complete a patient information form that asks for their name, address, phone number, and brief medical history,

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