Write a program to create a class named 'agecalculator', containing variable 'year', 'month'. Create two objects of the class, one containing present year, month and another containing your birth year, month. Subtract and show the difference between two date by using both member function and friend function.
Q: Write a C++ program to create a class that captures planets. Each planet has a name, a distance from…
A: Program approach: Create class planets. Declare private variables. Create a constructor. Create a…
Q: Create a new class called Dog that is derived from the Pet class given in Listing 6.1 of Chapter 6.…
A: CODE TO COPY:-
Q: Given the class Pet below, write a client program to read data for five pets and display the…
A: The required Java code is: /**Class for basic pet data: name, age, and weight. */import…
Q: 4. Write a program to create a class named 'height', containing variable 'feet', 'inch'. Create two…
A: Here I have created the class named height. In this class, I have created the data members named…
Q: Write a program that use two classes. Calculate the factorial of a given number by using one class…
A: Constructors are the functions which have same name as class name and whenever an instance is…
Q: rewrite and Insert the missing part of the code below for a class to define Book... with two…
A: #include <iostream>using namespace std;class Book{private: string title; int…
Q: Consider the class Students declaration and its constructor has two arguments (the data type of the…
A: Syntax for creating object of class. Classname object= new classname(parameters);
Q: You are given a super class called People and a sub-class (derived class) called Engineer. The…
A: Option D is correct "Engineer a = new Engineer(); ...;a.update();"
Q: Write a program that defines a class with a data member to holds a "serial number" for each obje…
A: Class is a user-defined data type in which it consists of data members and member functions. The…
Q: Define and implement a class named animal that has the following constructor and attributes:…
A: Inheritance : Inheritance is a concept that acquires the properties from one class to other classes;…
Q: Now write a test program that performs the following tasks: 1. Create a Faculty object with an id of…
A: A Computer Program is a set of instructions , that can be executed by a computer to perform a…
Q: You are creating a program to make Cars. Each Car has an Engine, which is declared as a separate…
A: Required code provided in below:
Q: rewrite and Insert the missing part of the code below for a class to define Book. with two…
A: In C++, Destructor is member function of the class which is called automatically when the object is…
Q: Create a class Date, with data members Day, Month and year. . Overload the constructor in Date, and…
A: class Date { Public: Date( string )…
Q: Write a program contained a class Student which has firstName, lastName, mark, grade. The program…
A: **Note: Save the code in a file named "Student.java" otherwise it will not compile. This is because,…
Q: Write a class named Patient that has attributes for the following data: First name, middle name,…
A: class Patient: first_name = "" middle_name = "" last_name = "" address = "" city = ""…
Q: Write a class Email that contain the following fields, which other classes may not access:
A: Java program: class Email { //instance fields private String to; private String from;…
Q: Write a program to create a class named 'vehicle', containing variable 'brand', 'horsepower'. Create…
A: For setting values we can make use of parameterized constructor and to initialize other object with…
Q: Create a class Employee with name, Id and salary as data members. Provide appropriate constructors,…
A: Given:-
Q: Write a class called profileID, which has data members firstName, lastName, age, and birthday.…
A: Note: - As the programming language is not mentioned to implement the class, data members and…
Q: Consider the following class, write a method that returns the name of the employee object. class…
A: Given :
Q: Exercise 2. a. Generate 3 Item objects using the all parameters constructor, let the user input all…
A: Note: As no programming language is mention. So I am using Java to answer this question.
Q: Create a class Employee that has a field for storing the complete name of the employee (first and…
A: Create a class Employee that has a field for storing the complete name of the employee (firstand…
Q: Given that Employee is a class, how many reference variables and objects are created by the…
A: Brief about the question: The question is based on the java class and object concept like we have…
Q: Write a program to print the area of a rectangle by creating a class named 'Area' having two…
A: Start Input length Input breadth Create instance Set Dimensions Print Area Stop
Q: Write a java program to create a room class, the attributes of this class is roomno roomtype, roomar…
A: Lets see the solution.
Q: Create two classes manager and employee which store (code, name, salary, department, and city).find:…
A: Class is a user-defined data type that encapsulates the data members and member functions/methods as…
Q: Write a program which controls a metro train and that keeps track of stations and who gets on and…
A: import java.util.Random; public class Train { static int stationNum; static int…
Q: Write a program using below table of constructor to initialize objects and calculate the salary of…
A: import java.util.Scanner;public class Employee { private String name; public double salary;…
Q: Write a program contained a class Student which has firstName, lastName, mark, grade. The class…
A:
Q: Create a Java Project (with a First class and a test class) to represent some real-world Objects…
A: Classes : First Class Test Class Data Members : Integer x,y,z Member functions : Constructor…
Q: consider an application to support buying and selling vintage musical instruments. Create a CRC card…
A: DESCRIPTION: Relational Database Design: Customer(SSN, Title,First_Name,Middle_Name, Last_Name,…
Q: I am not sure how to ask this question, but I need help in understanding the usage of :: when…
A: given: void add_name(string name){ class_name::variable_name = name; }
Q: B: Create a class called Employee that includes five pieces of information as: instanc variables:…
A: 1. Creating a class Employee 2. Taking private instance variable Full_name , age, address,…
Q: fine and implement a class named animal that has the following constructor and attributes:…
A: The given problem is related to Inheritance, polymorphism, abstraction and information hiding in…
Q: Write a function that overwrite the greater than method for a class. The class has a field variable…
A: Given, The function to be implemented should overwrite greater than,and it has to implement less…
Q: Assume you are given a class called Tyre that has two attributes type and size of type String. There…
A: Assume you are given a class called as Tyre that has two attributes type and size of type String.…
Q: Question#2: Define a class, mcmLength, to represent a length measured in meters, centimeters, and…
A: This is the Point class definition. It is used by the Rectangle class // Create a Point object…
Q: Write a class, XXXX_TestVehicle, which does the following:Creates one Truck object from information…
A: B.elow is the java code for the class and object.
Q: Write a program which controls a metro train and that keeps track of stations and who gets on and…
A: Actually, Python is the easiest programming language. It is a dynamically typed programming…
Q: Create a class to compute the average grade (out of 10) of the students based on their grades in…
A: Objective: This program should include a class to store grades of five exams of students. It should…
Q: Write a program using a class to convert cube to cube root and vice-versa. Write conversion methods…
A: As language is not mentioned so I am writing code in C++ language. CODE - #include <iostream>…
Q: write a program using java Create a class named “Rectangle” having length and width as attribute.…
A: GIVEN: write a Java program with Create“Rectangle” having length and width as attributes. write the…
Q: Which of the following statements is false? a. A class can contain only one constructor. b. An…
A: False statement Constructor is a class method whose instructions are automatically invoked each…
Q: You have to make a class and in which a variable is present and you have to perform addition of 2…
A: Required:- You have to take a class and in which a variable is present and you have to perform the…
Q: Design a class called Pokemon using a parameterized constructor so that after executing the…
A: Here, Code instruction is given.
Q: In this exercise, you will design various classes and write a program to computerize the billing…
A: Actually, java is a object oriented programming language. It is a platform independent.
Write a program to create a class named 'agecalculator', containing variable 'year', 'month'. Create two objects of the class, one containing present year, month and another containing your birth year, month. Subtract and show the difference between two date by using both member function and friend function.
Step by step
Solved in 2 steps with 1 images
- Create a class called Employee that includes three pieces of information as data members—a first name (type string), a last name (type string) and a monthly salary (type int). Your class should have a constructor that initializes the three data members. Provide a set and a get function for each data member. If the monthly salary is not positive, set it to 0. Write a test program that demonstrates class Employee’s capabilities. Create two Employee objects and display each object’s yearly salary. Then give each Employee a 10 percent raise and display each Employee’s yearly salary again.Write a program to create a class teacher with the following data members.ID: Can be accessed only from the teacher class and derived classes of the teacher.Age: Can be accessed from all the classes and packages in the application.Phone Number: Can be accessed only from the classes inside the same package.Write the constructor function. Derive a class Math_teacher from the teacher class, add the following two data members in the Math_teacher class.Room Number: This can be accessed by all the classes in the application.Course_ID: This can be accessed by all the classes in the same package.Write the constructor function.Create a class called Name that contains data members of type string called first name, middle name, last name, and salutation. Add a constructor that takes four parameters which are used to initialize the four data members and a member function called to-string that returns the person's full name in the form of “Salutation First name Middle name Last name”. Finally add set and get functions for all the data members. Add a destructor to the program displaying a suitable msg.
- Write a class ‘Box’ which has three members height, width and depth; To set values and use these members, write mutator and accessor functions for these members. (Hint: there would be 3 Accessor and 3 Mutator functions).Create two classes named Mammals and MarineAnimals. Create another class named BlueWhale which 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 as Marine Animals" respectively. Now, create an object for each of the above class and try calling function of Mammals by the object of Mammal function of BlueWhale by the object of BlueWhale function of each of its parent by the object of BlueWhale function of MarineAnimal by the object of MarineAnimalCreate two classes named Mammals and MarineAnimals. Create another class named BlueWhale which 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 as Marine Animals" respectively. Now, create an object for each of the above class and try calling:1 - function of Mammals by the object of Mammal2 - function of MarineAnimal by the object of MarineAnimal3 - function of BlueWhale by the object of BlueWhale4 - function of each of its parent by the object of BlueWhale Note: use OOP concepts and use C++
- Create two classes named Mammals and MarineAnimals. Create another class named BlueWhale which 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 as Marine Animals" respectively. Now, create an object for each of the above class and try calling 1 - function of Mammals by the object of Mammal 2 - function of MarineAnimal by the object of MarineAnimal 3 - function of BlueWhale by the object of BlueWhale 4 - function of each of its parent by the object of BlueWhaleCreate 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 whichprints "I am mammal", "I am a marine animal" and "I belong to both the categories: Mammals aswell as Marine Animals" respectively. Now, create an object for each of the above class and trycalling1 - function of Mammals…Create a class named Employee which contains an employee name, available to the entire program (public), and an employee ID number and hourly pay rate, available only to the members of the Employee class (private). Also write a constructor (the __init__ member function) which accepts a pay rate and changes it to 7.25, if the value entered is less than that. Do not write any accessor or mutator methods for the class.Create a class Student with attributes StudentName, Enrollment, semester, section, course MarksObtained and Grade. Write appropriate constructors, get and set functions for data members. The data member grade is automatically calculated based on marks obtained out of 100 for each course.
- Create a class Employee with following data members, name, id, and salary as private datamember. Create array of objects for four employees, compare their salary using operatoroverloading, and display the records of the student who is getting less salary. by c++Objective Create a class named Complex to represent complex numbers. Use the main() function and create at least three complex number objects and test all member functions of the Complex class. How to use classes. Create a program named LastnameFirstname19.cpp, that does the following: Note: There is no user input in this assignment. Copy and paste the Complex class definition from the previous assignment to this one. If you did not complete the previous assignment, you will need to create the class definition. Make any corrections to your Complex class based on the feedback provided from Assignment 18. Add the following member functions to the Complex class definition: Additional constructor with 2 parameters Signature: Complex(double realParam, double imaginaryParam) Allows a Complex object to be created with the specified real and imaginary parts. copy constructor Signature: Complex(const Complex ©Complex) Copies the data members from copyComplex to this object.…Create a class named RealEstate that has data members to hold the price of a house, the number of bedrooms, and the number of baths. Make a member function get_Data() that gets the RealEstate's data from the user, and throws an appropriate error message if negative values are entered for any of the data members. Add a display() function that displays the RealEstate's data. Write a main() function that instantiates a RealEstate object, allows the user to enter the RealEstates data, use an ofstream object to store the RealEstate's data in RealEstate.dat file, and close the ofstream object. Then open an ifstream object to read information from file, RealEstate.dat, and displays the information.