Chapter 10 defined the class circleType to implement the basic properties of a circle. (Add the function print to this class to output the radius, area, and circumference of a circle.) Now every cylinder has a base and height, where the base is a circle. Design a class cylinderType that can capture the properties of a cylinder and perform the usual operations on the cylinder. Derive this class from the class circleType designed in Chapter 10. Some of the operations that can be performed on a cylinder are as follows: calculate and print the volume, calculate and print the surface area, set the height, set the radius of the base, and set the center of the base. Also, write a program to test various operations on a cylinder.
Trending nowThis is a popular solution!
Chapter 11 Solutions
C++ Programming: From Problem Analysis To Program Design, Loose-leaf Version
- This is a polymorphism assignment I can't seem to figure out for Java Create an abstract class named Shapes. The Shapes class has only the calcArea() method. From Shapes, create three derived classes named Circle, Square and RightTriangle. Each of the three should have data members used to calculate the area of its shape. Define the method calcArea() for each of the three shapes. Each of the three shapes should also have appropriate constructors. Not required, but create a class with the main() method to test the classes created above.arrow_forwardJava- Suppose that Vehicle is a class and Car is a new class that extends Vehicle. Write a description of which kind of assignments are permitted between Car and Vehicle variables.arrow_forwardTake the tax program from the last homework assignment and implement it using classes and objects instead. To do so, create a class definition for a class called Customer with attributes income and tax. It should also have a set method for income, and a calcTax() method to assign tax and return it. As a reminder, the tax is calculated as follows: Income Tax Due $0 - $50,000 5% $50,000-$100,000 $2,500 + 10% of (income > $50,000) > $100,000 $7,500 + 15% of (income > $100,000) Create a Customer object in main, have the user enter the income and assign this to the income variable of the Customer object, and then call the calcTax() method for the Customer object and print the tax due.arrow_forward
- #this is a python programtopic: operation overloading, Encapsulation please find the attached imagearrow_forwardCreate a class BeautyProduct with name, color, brand. Provide Constructors, getters, setters and also write toString method. Now create a class Lipstick which extends the class BeautyProduct as Lipstick is-a Beauty Product it has totalVolume, remainingVolume, price, texture (gloss, matt) as private data members. Provide Constructors, getters, setters and an apply() method whenever this method is called a beauty item is applied and its volume decreases by 10.This should also check that volume must not be zero if it then u have to throw exception. Also write toString method which prints all details like name, color, brand, price, texture and volume. Create another class foundation having totalVolume, remainingVolume, price, texture (liquid, cake) and lastingTime (number of hours foundation remain intact on face and does not crease) as private data members. This also extends the base class i.e. BeautyProduct. Provide Constructors, getters, setters and an apply() method whenever this…arrow_forwardplease solve it with java and put screenshots of the codearrow_forward
- Every cylinder has a base and height, where the base is a circle. Design the class Cylinder that can capture the properties of a cylinder and perform the usual operations on a cylinder. Derive this class from the class Circle (done through Problem 3.2). Please do the following: Some of the operations that can be performed on a cylinder are as follows: calculate and print the volume, calculate and print the surface area, set the height, set the radius of the base, and set the center of the base. Write a test program to test your program. Note: Java programming. Please also send the test program so I can run it in dr java and learn. Use given code and design the class cylinder that can capture the properties of a cylinder and perform the usual operations on a cylinder. Point code: // class Point public class Point{protected double x, y; // coordinates of the Point //Default constructorpublic Point(){setPoint( 0, 0 );} //Constructor with parameterspublic Point(double xValue, double…arrow_forwardWrite a Number class that holds a double, and add overloaded operators for +, –, *, /, and assignment. Choose the return values for these functions so that expressions can be chained together, and for efficiency. Write an automatic type conversion operator int( ). Please submit code inarrow_forwardwrite a class Point with parametrized constructor. This class have four member variables, a,b,c,d. Write the following member functions a. drawTriangle(int x, int y, int z ) b. drawRectangle(int x, int y, int z, int a). Each function should display the length of lines for each of the shape (triangle, rectangle). For example triangle should calculate length of its three lines by following methods as shown in code. Note: the number of lines depends on the name of shape. void drawTriangle(int x, int y, int z ) { int line 1 = x - y; // convert to positive value if line length is negative int line 2 = y -z; int line 3 = z -x; cout<< The length of each lines is: << //// here display length of each line with proper formatting. } Write similar code for drawRectangle(int x, int y, int z, int a). Wtite main function to call these three functionarrow_forward
- Write the missing code in the dark picture. This is not gradedarrow_forwardYou are going to be working with class Rational which defines rational number objects. A rational number is a number that can be written as a fraction. A rational number consists of a numerator and a denominator (which cannot be 0). Rational numbers also have the ability to be displayed in an original form, decimal form or reduced form. You are going to be completing various object methods to perform the tasks previously list. You are to begin with the Rational Class and RationalTest classes provided. Make all modifications outlined in the point values below. Pay close attention to the names of the attributes, methods and return values. You are given starter files and the test files necessary. Only modify class Rational and keep the function headers provided to you for all of Part 1. You will need to add your own methods for Part 2. Part 1a This version requires that you complete the constructor, getOriginal(), and getDecimal() methods of class Rational. Constructor: at this stage…arrow_forwardplease anser within 30 minutes...arrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning