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
Trending nowThis is a popular solution!
Chapter 11 Solutions
C++ Programming: From Problem Analysis to Program Design
- 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_forwardCreate a class Mammal and another class WingedAnimal. Make a class Bat that is derived from both the classes as bat is a mammal as well as a winged animal.Make constructor of each class and test your classes by making an object of Bat in main function.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_forward
- Take 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_forward1. Implement the above system using inheritance in the best possible way. Keep every object size as small as possible. Implement all methods (setter/getter/constructors and destructors) Note that the region area is 0 while the city is len*width and the country is the sum of their cities. 2. Create array of countries called Arab of 22 countries, Write a function fill that fills the arrav Arab 3. Write a method that finds the city that has the max area in a country 4. Write a method that sorts the cities in a country from the largest to the smallest area 5. Write a function that retums array of countries of the same area of Arab 6. Write a function that compares between two countries. It returns true if countryl area greater than country2 area. 7. Write a function to move a city from one country to another.arrow_forward
- Create 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_forwardDeeper Class Design - the Square Class In this section, your job will be to write a new class that will adhere to the methods and data outlined in the “members” section below (said another way, your classes will implement a specific set of functions (called an interface) that we’ll describe contractually, ahead of time). These classes will all be shapes, with actions (methods) that are appropriate to shape objects, such as “getArea()”, or “draw()”. First we build a Square class that contains the following data and methods listed below, and then later, we will copy it to quickly make a Circle class. Note: when considering each data item below, think about what type of data would best represent the concept we’re trying to model in our software. For example, all shapes will have a coordinate pair indicating their location in a Cartesian coordinate system. This x and y pair may be modeled as ints or floats, and you might choose between the two depending on what the client application will…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_forwardplease code in python Answer the following questions about this Dog class: [refer image for dog class] 1. Construct an instance of the Dog class whose name is Snickers and was born in2011 and assign that instance to a variable called myDog.2. Call the bark method so that myDog barks 3 times.3. Add a method to the Dog class called isPuppy that returns True if the dog is lessthan 1 year old.4. Add the __str__ method to the Dog class. It should return a string that includesthe dog’s name and age.arrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning