a. Construct a class named Rectangle that has deuble-precision data members named length and width. The class should have member methods named perimeter() and area() to calculate a rectangle's perimeter and area, a member method named setData() to set a rectangle's length and width, and a member method named showData() that displays a rectangle's length, width, perimeter, and area. b. Include the Rectangle class constructed in Exercise 9a in a working C++ program.
Q: B) Create two classes named Mammals and MarineAnimals. Create another class named BlueWhale which…
A: UML class diagram of the classes In the above diagram, the classes Mammalls and MarineAnimals are…
Q: write a program to print the area and perimeter of a triangle having sides of 3 4 and 5 units by…
A: As no programming language is mentioned, it is solved using basic C++
Q: Create a class called Quadratic for performing arithmetic on and solving quadratic equations. A…
A: # include<iostream> using namespace std; class quadratic { private: double a; double b;…
Q: Create two classes named Mammals and MarineAnimals. Create another class named BlueWhale which…
A: Given: Create two classes named Mammals and MarineAnimals. Create another class named BlueWhale…
Q: Write a program to create a class named Student. Student class have two sub classes UnderGraduate…
A: Define a class Student. Define two data members name and age inside it. Define a sub class…
Q: 4. Define a concrete dlass Sphere which extends the Shape class. a. It has radius field of type…
A: SHORT SUMMARY: Provided the source code and sample run as per the requirement. SOURCE CODE:…
Q: Construct a class named Square that has a floating-point data member named side. The class should…
A: Solution: this program consists with two files - 1. Square.h - this file contains Square class and…
Q: Create a class called Bill that a hardware store might use to represent a bill for an item sold at…
A: Introduction of the Program: The C++ program uses the Bill class and the constructor is used to…
Q: Create a new data type Fraction using classes. The each fraction should have two parts numerator and…
A: C++ Program for above : #include <iostream> using namespace std; class fraction{…
Q: Create a class named Employee which contains an employee name, available to the entire program…
A: In this question, you need to create one class called 'Employee' which contains 3 variables. (…
Q: Define a class with the following specifications: Create a class called MarathonRunner that has…
A: Actually, program is a executable software that runs on a computer.
Q: In this exercise, you will design various classes and write a program to computerize the billing…
A: Actually, program is a executable software that runs on a computer.
Q: Construct a class named rectangle that has double-precision data members named length and width. The…
A: The Rectangle class contains 3 member variables and 4 member methods. variables are length and ,and…
Q: 3. Create a class called Employee whose objects are records for an employe e. This class will be a…
A:
Q: create a class called Date that contains data members representing day month, year of a particular…
A: The program will show the date with proper formats for day, month and year. The class Date will have…
Q: Construct a class named Circle that has a floating-point data member named radius. The class should…
A: The program is written in C++ Circle.h class Circle{ private : float radius; public:…
Q: #c++# Write a program that inputs a line of text, replaces all punctuation marks with spaces.
A: Note: - As per our guidelines we can only answer one question at a time. Please resubmit the other…
Q: Construct a class named Square that has a floating-point data member named side. The class should…
A: Data hiding restrict the data access to class members. It maintains data integrity. It is…
Q: Create a class called Complex for performing arithmetic with complex numbers. Write a program to…
A: The solution as given below steps :
Q: Create a class called person that contains private variables: ID, name, job, salary, start…
A: Required: Required code with comments for explanation and screenshot of both code and output has…
Q: Q4) Write a class "Rectangle'" with three data members: "width", "height" and "color"; and four…
A: Algorithm: Start Define a class Rectangle with length, width and color as its members Define init()…
Q: Write a program to create a class named 'agecalculator', containing variable 'year', 'month'. Create…
A: #include <iostream>using namespace std;//creating class agecalculatorclass agecalculator{…
Q: Write a program that has a base class named FlightCrew. This class should have three data members:…
A: Summary: In this question, using the class concept in C++ we need to generate a bonus amount for…
Q: Q1: Implement a class called Animal. a) A class named Animal b) Private data members: species and…
A: The given problem is related to Object-Oriented programming where a Class Animal and a driver main…
Q: Write a program to make a class of English Distance with data members feet and inches, and member…
A:
Q: Create two classes named Mammals and MarineAnimals. Create another class named BlueWhale which…
A: Define header file <iostream> for input output operations. Define header file <string>…
Q: ). Develop a class named Department with two data members: name and size. The name can take values…
A: public class Department { private String name; private int size; public String getName()…
Q: The class a) Create a total of 5 member variables for the class by selecting the appropriate data…
A: The answer given as below:
Q: 01 Create a class called person that contains private variables: ID, name, job, salary,…
A: Objective: A program should be designed with a parent class "Person" and two child classes…
Q: Given the following class, called NumberHolder, write some code that creates an instance of the…
A: In this given problem we need to design a class NumberHolder. Inside that, we need to declare one…
Q: Q1 Create a class called person that contains private variables: ID, name, job, salary,…
A: Below is the required Java program: - Approach: - In the below program a class is created named…
Q: Create a class called Distance containing two members feet and inches. This class represents…
A: “Since you have posted a question with multiple sub-parts, we will solve first three subparts for…
Q: C++ Create a simple employee class that supports two classifications of employees, salaried and…
A: Code: #include <iostream> using namespace std; class Employee{ string…
Q: In java,Create a class called time that has separate int member data for hours, minutes, and…
A: Objective: This program creates a class naming TimeClass including member variables hours, minutes,…
Q: Create a class called person that contains private variables: ID, name, job, salary,…
A: Solution code #include <iostream> using namespace std; // person classclass Person {…
Q: Suppose in Islamabad International Airport the plans arrivals and departures are frequent and they…
A: Sample Response: //C++ program to computes the kinetic energy#include <iostream>using…
Q: Create a class Employee with following data members, name, id, and salary as private data member.…
A: Required: Create a class Employee with following data members, name, id, and salary as private data…
Q: create two classes named mammals and marine animals. create another class named blue whale which…
A: Program: Program is used to provide general instructions to the computer system in order to perform…
Q: program in c++ ,Create a class called Complex for performing arithmetic with complex numbers.Write a…
A: PROGRAM EXPLANATION: - The complex numbers are simulated using complexNum class. This class…
Q: eed use accelerate and brake functions that add and subtract 5 from speed each time it is called.…
A: #include <iostream>#include <cstring>#include <cctype>using namespace std; class…
Q: 01 Create a class called person that contains private variables: ID, name, job, salary,…
A: Inheritance is a feature in java where one class (sub class) acquires the property of another class…
Q: Using python. Create a class which should include three public data members: int speed, int gas,…
A: class Car: #Define constructor def __init__(self, speed, gas, on): #public…
Q: Q4) Write a class "Rectangle" with three data members: "width", "height" and "color"; and four…
A: Algorithm: Start Define a class rectangle with height width and color as its members In the init()…
Q: Create a class called Complex for performing arithmetic with complex numbers. Write a program to…
A: Program: //Header file section #include<iostream> #include<stdio.h> using namespace std;…
Q: 2.1. Create a class named Lease with fields that hold an apartment tenant’s name, apartment number,…
A: Given: 2.1. Create a class named Lease with fields that hold an apartment tenant’s name, apartment…
Q: 5.3. Create a class of Distance including feet and inches. Class should consist minimum required…
A: // iostream in C++ is the standard library which implement stream based input/output capabilities…
Q: Construct a class named Circle that has a floating-point data member named radius. The class should…
A: Circle has a radius as an instance variable of the Circle class. The class contains the functions…
Q: reate two classes named Mammals and MarineAnimals. Create another class named BlueWhale which…
A: CODE-- #include<bits/stdc++.h>using namespace std;class Mammals{ public: void printMammals()…
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images
- Construct a class named rectangle that has double-precision data members named length and width. The class should have member methods named perimeter() and area() to calculate a rectangle's perimeter and area, a member method named setData() to set a rectangle's length and width, and a member method named showData() that displays a rectangle's length, width, perimeter, and area.create a class called Date that contains data members representing day month, year of a particular date. A. Add a constructor who initializes the value of date as 1/1/2001 and displays the date by calling a member function to-string that represents the date in the form of “Day/Month/year”. B. Output the Date in multiple formats such as a. DD YYYY b. MM/DD/YYYY c. DD.MM.YYYY d. June 14, 2001 C. Use overloaded constructor to create Date objects initialized with dates of the format in part (b). D. Create a Date constructor that reads the system date using standard library function of the <ctime> header and sets the data members. a. https://onlinegdb.com/NaakQKYJI (Refer this code for the usage of ctime) b. C++ Date and Time (tutorialspoint.com) (Go through this for more understanding) E. Add a destructor to the program displaying a suitable msg.Create a class called Distance containing two members feet and inches. This class represents distance measured in feet and inches. For this class, provide the following functions: a. A no-argument constructor that initializes the data members to some fixed values. b. A 2-argument constructor to initialize the values of feet and inches to the values sent from the calling function at the time of creation of an object of type Distance. c. Add distance function to add two distances: Feet and inches of both objects should add in their corresponding members 12 inches constitute one foot. Make sure that the result of addition doesn’t violate this rule. d. Is greater: should return a variable of type bool to indicate whether 1st distance is greater than 2nd or not. e. Is smaller: should return a variable of type bool to indicate whether 1st distance is smaller than 2nd or not. f. Is greater equal: should return a variable of type bool to indicate whether 1st distance is greater than or equal…
- #c++# Write a program that inputs a line of text, replaces all punctuation marks with spaces. 2.Create a class called Complex for performing arithmetic with complex numbers. Write a program to test your class. Complex numbers have the form realPart + imaginaryPart * i where i is Use double variables to represent the private data of the class. Provide a constructor that enables an object of this class to be initialized when it’s declared. The constructor should contain default values in case no initializers are provided. Provide public member functions that perform the following tasks: Adding two Complex numbers: The real parts are added together and the imaginary parts are added together. Subtracting two Complex numbers: The real part of the right operand is subtracted from the real part of the left operand, and the imaginary part of the right operand is subtracted from the imaginary part of the left operand. Printing Complex numbers in the form (a, b), where a is the real…Q1: Create two classes named Mammals and SeaAnimal. Create another class named Whale whichinherits both the above classes. Now, create a function in each of these classes which prints "I ammammal" in class Mammals, "I am a marine animal” in class Marine and "I belong to both thecategories: Mammals as well as Marine Animals" in class Whale. Now, create an object for each of theabove class in main function and try calling.1 - function of Mammals by the object of Mammal2 - function of SeaAnimal by the object of SeaAnimal3 - function of Whale by the object of Whale4 - function of each of its parent by the object of WhaleConstruct a class named Square that has a floating-point data member named side. The class should have a zero-argument constructor that initializes this data member to 0. It should have member functions named calcPerimeter() and calcArea() that calculate the perimeter and area of a square respectively, a member function setSide() to set the side of the square, a member function getSide() to return the side, and a member function showData() that displays the square’s side, perimeter, and area. The formula for the area of a square is Area = side * side. The formula for the perimeter of a square is Perimeter = 4 * side. The class should use appropriate protection levels for the member data and functions. It should also follow “principles of minimalization”: that is, no member data should be part of a class unless it is needed by most member functions of the object. Use your class in a program that creates an instance of a Square (utilizing the zero-argument constructor), prompts a user…
- CPP OOP - Create two classes named Mammals and MarineAnimals. Create another class named BlueWhalewhich inherits both the above classes. Now, create a function in each of these classes which prints"I am mammal", "I am a marine animal" and "I belong to both the categories: Mammals as well asMarine Animals" respectively. Now, create an object for each of the above class and try callingfunction of Mammals by the object of Mammalfunction of BlueWhale by the object of BlueWhalefunction of each of its parent by the object of BlueWhalefunction of MarineAnimal by the object of MarineAnimalUsing object-oriented principles, write a C++ program that will analyze a year's worth of rainfall data. Within the class, create a private member function called getData that will read in the data from an input file called rain2019.txt. This file contains the total rainfall for each of the 12 months. Read the contents of this file into a float array. The class should have four private member functions that compute and return totalRainfall, averageRainfall, driestMonth, and wettestMonth. The last two private member functions return the number of the month with the lowest and highest rainfall amounts, not the amount of rain that fell in those months. Notice that the month number can be used to obtain the amount of rain that fell those months. Create a private member function called displayReport that will print a summary rainfall report similar to the following (NOTE: this is only an example of format, not accurate data): 2019 Rain Report for Alachua County Total rainfall: 34.19…Create two classes named Mammals and MarineAnimals. Create another class named BlueWhalewhich inherits both the above classes. Now, create a function in each of these classes which prints"I am mammal", "I am a marine animal" and "I belong to both the categories: Mammals as well asMarine Animals" respectively. Now, create an object for each of the above class and try callingfunction of Mammals by the object of Mammalfunction of BlueWhale by the object of BlueWhalefunction of each of its parent by the object of BlueWhalefunction of MarineAnimal by the object of MarineAnimalCreate two classes named Mammals and MarineAnimals. Create another class named BlueWhalewhich inherits both the above classes. Now, create a function in each of these classes which prints"I am mammal", "I am a marine animal" and "I belong to both the categories: Mammals as well asMarine Animals" respectively. Now, create an object for each of the above class and try callingfunction of Mammals by the object of…
- ) Create two classes named Mammals and MarineAnimals. Create another class named BlueWhalewhich inherits both the above classes. Now, create a function in each of these classes which prints"I am mammal", "I am a marine animal" and "I belong to both the categories: Mammals as well asMarine Animals" respectively. Now, create an object for each of the above class and try callingfunction of Mammals by the object of Mammalfunction of BlueWhale by the object of BlueWhalefunction of each of its parent by the object of BlueWhalefunction of MarineAnimal by the object of MarineAnimal in c++?Create a class called Date that includes three pieces of information as data members—a month (type int ), a day (type int ) and a year (type int ). Your class should have a constructor with three parameters that uses the parameters to initialize the three data members. For the purpose of this exercise, assume that the values provided for the year and day are correct, but ensure that the month value is in the range 1–12; if it isn’t, set the month to 1. Provide a set and a get function for each data member. Provide a member function displayDate that displays the month, day and year separated by forward slashes ( / ). Write a test program that demonstrates class Date ’s capabilities.Using object-oriented principles, write a C++ program that will analyze a year's worth of rainfall data. Within the class, create a private member function called getData that will read in the data from an input file called rain2019.txt. This file contains the total rainfall for each of the 12 months. Read the contents of this file into a float array. The class should also have four private member functions that compute and return the totalRainfall, averageRainfall, driestMonth, and wettestMonth. The last two private member functions return the number of the month with the lowest and highest rainfall amounts, not the amount of rain that fell in those months. Notice that the month number can be used to obtain the amount of rain that fell those months. Create a private member function called displayReport that will print a summary rainfall report similar to the following 2019 Rain Report for X CountyTotal rainfall: 34.19 inchesAverage monthly rainfall: 2.85 inchesThe least…