5.3. Write the program, which has two classes one, is Date having members (day, month, year) and the other class is called Employee. The employee has Date class as member as each employee has Date of joining, Date of Birth etc. a. Determine if an employee joined the organization within last five years if the current year is 2012. b. Determine if an Employee has age less than 40 years?
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 to take input name, ID and marks of 4 Courses (Physics111, Math120, English102 &…
A: Algorithm: Start READ Name READ ID READ Phy_Marks READ Math_Marks READ Eng_Marks READ CSE_Marks…
Q: Q1:write a program to create the following classes Sale house co. 1-read data for each class…
A: Solution: Given,
Q: Write the program, which has two classes one, is Date having members (day, month, year) and the…
A: CODE : #include <iostream> using namespace std;class employ{ public: int day;…
Q: Problem A Write a class FinancialAidApplicant which describes an applicant for financial aid and…
A: Algorithm: Start Create a class named FinancialAidApplicant with attributes name, householdIncome…
Q: q1 A. Add a segment of code to the int main() function of the given employee program to create an…
A: We have to write a program Add a segment of code to the int main() function of the given employee…
Q: -E4.24 Implement a class Balloon that I with air. The constructor methods: •void addAir (dou •double…
A: Source Code:- Balloon.java public class Balloon { private double radius; public Balloon() { } //adds…
Q: Task - 4 Given the following classes, write the code for the Book and the CD class so that the…
A: According to the information given:- We have to write a program on the basic of product class , 2…
Q: Build a class called BankAccount that manages checking and savings accounts. The class has three…
A: Use if condition to check whether the amount is positive or not
Q: 5. Given the definitions of class x (Figure 3) and class Y (Figure 4) below, class x { private int…
A: SolutionFigure 3 In line 2, create a class instance of name x In line 3, created an attribute of…
Q: Given the following class specification, provide the correct print out of the following function…
A: cout<<b.x<<endl; NOT ALLOWEDExplanation: object b is trying to access the protected…
Q: 6. Suppose we have two classes, one of which extends the other: class Base (...); class Derived:…
A: Since variable b is declared as a Base* type The static type of variable b after line 4 has been…
Q: Write a program that would print the information (name, year of joining, salary, address) of three…
A: Code: class Employee{ private String name, address; private int year, salary; public…
Q: Create two classes DM and DB which store the value of distances. DM stores distances in meters and…
A: Program: #include<iostream>using namespace std;class DB;class DM{int m;double cm;public:void…
Q: Question 2: Consider the following code and write the complete definition of the mentioned class…
A: A class is a user-defined data type that combines data members and methods for manipulating that…
Q: Write the following program in C++. 1. Create a class called Employee that includes attributes:…
A: Array indexing starts from 0 So, to access nth employee, we have to access the employee at index n-1
Q: QUESTION 28 Consider the following code: 1. public class Circle { private int radius; private int x;…
A: Given:
Q: 10)Suppose Car and Motorcycle are subclasses of Vehicle. Which of these declarations are allowed? a)…
A: To perform a specific task some set of grammatical rules and vocabulary used for give instruction to…
Q: Q5: Consider the following code. [14] class A { protected: double x; public: A() { coutShow(); Line…
A: a) List down the abstract and concrete classes? Ans: Note: If we do not override the pure virtual…
Q: - P2.22 Implement a class Moth that models a moth flying along a straight line. The moth has a…
A: Consider: lightPosition initalPosition as the public double variables of the class Moth
Q: Write a C++ program to create two dates by using a class date. Initialize one date with day=4,…
A: Write a C++ program to create two dates by using a class date. Initialize one date with day=4,…
Q: b. Modify the Downdog Yoga Studio program so that numeric class requests can be entered continuously…
A: I have written C++ code, pseudocode and flowchart
Q: 2. Write a program to implement the following scenario The classes teacher, typist and officer is…
A: Code: #include <iostream> using namespace std;class staff{ private: string code,name;…
Q: Question: 3 Implement the design of the Doctor and Engineer class derived from Person class so that…
A: Question given: A program code is given, that implements classes. Write class code that produce…
Q: Kindly store employee details using class with python program [2/25, 05:28] Vishal Singh Rawat:…
A: Python: Python is a general purpose programming language developed by Guido Van Rossum in 1989.…
Q: 5. Given the definitions of class x (Figure 3) and class Y (Figure 4) below, class x { 3 private int…
A: 4 3 6
Q: ????????: Implement the design of the ECustomer class so that the following output is produced:…
A: class ECustomer: count = 0 def __init__(self, name): self.name = name…
Q: WAP of using classes to read the customer information name, bill no, address, and calculate monthly…
A: #include <iostream> using namespace std; class bill{ public:int bill_no; public: int…
Q: Problem 2: Suppose the following description for three classes: Class named Person and two…
A: //Class person has attrributes name, address,phone number, email addressclass Person { public…
Q: 5. a) Write a Class C which should extend Class B in the below example? class A { class B {
A: Note: There are multiple questions given in one question. According to the rule, you will get the…
Q: Consider the following code and write the complete definition of the mentioned class according to…
A: Code: #include <iostream>#include<string>using namespace std;class Employee{//class…
Q: Q2: A: Write the definition of class Example as follows: 1. Three public instance variables x, y and…
A: Note: Answering in python as no language is mentioned. Define class Example with the following data…
Q: Write a program (read and print information) that simulates the three classes defined as shown…
A: Inheritance is a concept in which one class acquires the properties of another class. An inheriting…
Q: PROBLEM B: Suppose that you want to define a class to group the attributes of an employee. There are…
A: using System;class personType { private string firstName; private string lastName;…
Q: C++ Assume we want to determine the commission received by a salesperson. The commission rate is…
A: C++ conditional statement: The "if" statement is a conditional statement that contains the condition…
Q: Q1: Implement a class called Animal. a)A class named Animal b) Private data members: species and…
A: “Since you have asked multiple questions, we will solve the first question for you. If you want any…
Q: to create a class named as ‘Employee’ with attributes i.e. ID, Name, Designation, Qualification,…
A: Write a python code to create a class named as ‘Employee’ with attributes i.e. ID, Name,…
Q: Consider the definition of the following class: public class CC { private int u;…
A: Constructor is a special method that has the same name as the class name. The constructor method…
Q: Problem A Write a class FinancialAidApplicant which describes an applicant for financial aid and…
A: If-else if-ladder conditional statement in java program: The multiple if conditions are checked in…
Q: c++ Implement a Class Book. Book shall have the following members: A member variable title of…
A: Code: #include<iostream>#include<stdio.h>#include<string.h> using namespace std;…
Q: Problem 2: Write a class for the following car example. Then instantiate three of them. You can use…
A: #include <iostream>#include <string>using namespace std; class Car { public: string…
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: 4b. Consider the class circleType as defined in Example 10-8 (Chapter 10). Suppose that the class…
A: 4b. Consider the class circleType as defined in Example 10-8 (Chapter 10). Suppose that the class…
Q: Write a program having a base class Student with data member rollno and member functions…
A: Program Explanation: 1) Implement the header file. 2) Put the integer name. 3) Then, enter the roll…
Q: 7. Consider the following design for a Product class that keep track of product inventory: public…
A: public class Product { public Product(String name, double qty) { prodName = name;…
Q: /** P3.2. Adding a method public void addInterest(double rate) to the…
A: Given: /** P3.2. Adding a method public void addInterest(double rate) to the…
Step by step
Solved in 2 steps with 2 images
- Consider the following class declaration and variable definitions, then answer the following questions. #include <stdio.h> class A { private: class B { public: B() { x = 1; } int x; int& getx() { return x; } void print() { printf(“%d”,x); } }; private: B b; public: class C { private: int w; public: C() { w = 5; } B b; int &getw() { return w; } void print() { b.print(); printf(“%d”,w); } }; C c; void print() { b.print(); c.print(); } int& getx() { return b.getx(); } }; Assume each code snippet in each row below runs independently in a main function. For each one, say whether it's legal code or not. If it is, show the output and explain why it happens. If it’s illegal (e.g. syntax error), explain why. Try to do it without running the code, and then check and correct your answers as needed. # Code snippet Errors? (Yes or No) Output or explanation of error. 1…Write C++ program containing class Issuebook whose members include char book name, int serialno , issue date and due date. Create one object of Issuebook b1 and display the following output shown in image.Consider the definition of the following class: public class CC { private int u; private int v; private double w; public CC( ) //Line 1 {…} public CC(int a) //Line 2 {…} public CC(int a, int b) //Line 3 {…} public CC(int a, int b, double d) //Line 4 {…} A. Give the line number containing the constructor that is executed in each of the following declarations: (i) CC one = new CC( ); _________________ (ii) CC two = new CC(5, 6); _________________ (iii) CC three = new CC(2, 8, 3.5); _________________ B. Write the definition of the constructor in Line 1 so that the instance variables are initialized to 0. C.Write the definition of the constructor in Line 4 so that the instance variables u, v, and w are initialized according to the values of the parameters a, b, and d,…
- Question: 3 write python program ; Implement the design of the Doctor and Engineer class derived from Person class so that the following code generates the output below:class Person: def __init__(self, name, contact): self.name = name self.contact = contact def __str__(self): s = f"Name: {self.name}\nContact: {self.contact}" return s#Write your code hered = Doctor("Dr Strange", "4585632", "Neurosurgery", "DMC")d.add_patients("Dhaka Abdur Rahim", "Dhaka John Cena", "Narayanganj John Wick", "Comilla CM Punk")print("1.=========================================================")print(d)print("2.=========================================================")d.show_patient_list("Dhaka")print("3.=========================================================")d.show_patient_list("Rajshahi")print("4.=========================================================")d.add_patients("Narayanganj Naruto…23.6 LAB: BankAccount class (Use Python) Build a class called BankAccount that manages checking and savings accounts. The class has three attributes: a customer name, the customer's savings account balance, and the customer's checking account balance. Implement the following constructor and instance methods as listed below: Constructor with parameters (self, new_name, checking_balance, savings_balance) - set the customer name to parameter new_name, set the checking account balance to parameter checking_balance, and set the savings account balance to parameter savings_balance. deposit_checking(self, amount) - add parameter amount to the checking account balance (only if positive) deposit_savings(self, amount) - add parameter amount to the savings account balance (only if positive) withdraw_checking(self, amount) - subtract parameter amount from the checking account balance (only if positive) withdraw_savings(self, amount) - subtract parameter amount from the savings account…in C++ Consider a class Movie that contains the following information about amovie:* Title* MPAA Rating (e.g. G, PG, PG-13, R)* Number of people who rated this movie as a 1* Number of people who rated this movie as a 2* Number of people who rated this movie as a 3* Number of people who rated this movie as a 4* Number of people who rated this movie as a 5Implement the Movie class such that it is able to contain the aboveinformation. Include a constructor that would accept two parameters andinitialize the movie's title to the value of its first parameter and the movie'sMPAA rating to the value of its second parameter, and public rating to 0. Alsoinclude accessor member functions for title and MPAA rating. Include a memberfunction to increment the public rating that will only accept integer valuesbetween 1 and 5. Finally, write a member function that would return the averagepublic rating of a movie.Write a program that would use your Movie class by first asking the user toinput movie…
- c++ Implement a Class Book. Book shall have the following members: A member variable title of type std :: string.A member variable pages of the type unsigned int.A member variable current_page of type unsigned int.A parameterized constructor that takes title and pages as input parameters.A change_page function to scroll to a given page.A next_page function to scroll to the next page.A prev_page function to scroll to the previous page.A superimposed outflow operator (<<) that prints current_page.It is not allowed to scroll outside the pages of the book (0 <current_page <pages). The members must be encapsulated in accordance with the usual convention. Create goat and set functions as needed. Input follows the format: title pages start_page Output should have the following format:current_page repeated three times after calling change_page, next_page, prev_page in sequence, see comments below. Input Expected outputHitchhikers 191 100…Q#2 Read out the following program carefully and explain each mentioned section (colored) of this program. Plus which type of inheritance this is?. #include <iostream> using namespace std; class A { public: int a = 5; A() { cout << "Constructor for class A" << endl; } }; class B { public: int b = 10; B() { cout << "Constructor for class B" << endl; } }; class C: public A, public B { public: int c = 20; C() { cout << "Constructor for class C" << endl; cout<<"Class C inherits from classes" << endl; } }; int main() { C obj; cout<<"a = "<< obj.a <<endl; cout<<"b = "<< obj.b <<endl; cout<<"c = "<< obj.c <<endl; return 0; }Q3: Write a program in C++ using OOP to create a class (A) , that contain integer number(x) , contain the iilnction (FACT) to calculate the factorial of (x!)and create a class (B) , that contain integer number (n ) , contain the functions (POWER),to calculate ( .xü).-Illen create a Class (C) , with public visibility mode inherit from class (A)and public visibility mode inherit from class (B),contain the tunction that find
- Question 5 C++ Write a class with dynamically allocated storage, write methods for that class and use the class. (it can be about anything, I am going to use this example to study for finals) .......c++ Write a grading program for a class with the following grading policies:a. There are two quizzes, each graded on the basis of 10 points.b. There is one midterm exam and one final exam, each graded on the basis of 100points.c. The final exam counts for 50 percent of the grade, the midterm counts for 25percent, and the two quizzes together count for a total of 25 percent. (Do not forgetto normalize the quiz scores. They should be converted to a percent before they areaveraged in.) Any grade of 90 or more is an A, any grade of 80 or more (but lessthan 90) is a B, any grade of 70 or more (but less than 80) is a C, any grade of60 or more (but less than 70) is a D, and any grade below 60 is an F.The program will read in the student’s scores and output the student’srecord, which consists of two quiz and two exam scores as well as thestudent’s average numeric score for the entire course and the final lettergrade. Define and use a Class for the student record.Q2: Consider the following statements: public class YClass { private int a; private int b; public void one() { } public void two(int x, int y); { } public YClass() { } } class XClass extends YClass { private int z; public void one() { } public XClass() { } } YClass yObject; XClass xObject; Write the definition of the default constructor of YClass so that the instance variables of YClass are initialized to 0. Write the definition of the default constructor of XClass so that the instance variables of XClass are initialized to 0. Write the definition of the method two of YClass so that the instance variable a is initialized to the value of the first parameter of two and the instance variable b is initialized to the value of the second parameter of two. please I want solution :(