Write a program that defines a class Employee with the following members as shown in the bellow UML diagram. 1) getAnnualSalary: Employee return the annual salary +name: string (f for the employee. +enpld: int 1monthsalary: double + ge LAanualsalary () :double addsalary (donbla): void + print (): void 2) addsalary: a void function that increases the salary of the employee by the parameter value. 3) Print: print the information for the employee In the main: 1) Declare 2 objects of type Employee (empl aud emp2). 2) Prompt the user to input 3 values to set the values ofempl. 3) Set the values ("Ali", "163878", 500) for emp2. 4) Print the annual salary for empl 5) Print the information of emp2 6) Prompt the user to enter a value then add it to the salary of emp2 (by calling the addSalary function). Then, prints the new price for emp2.
Q: Suppose class Rectangle has a public member function getLength() Then given the following statements…
A: Question:
Q: (b) The class diagram below shows the relation of three classes of a program. The class Employee is…
A: #include <iostream>using namespace std; class Employee{ private: static int…
Q: Use the following partial class definitions to answer the questions a-c…
A: 1 a) following is true with respect to A1, A2 and A3? A2 and A3 are both subclasses of A1 A3 is a…
Q: 4. In a restaurant, whenever customers visit, they are provided with items from two categories, one…
A: Answer: Algorithms 1.Given abstract class fixedCategory in this given bottle price and salad price…
Q: Write a C++ program to calculate the area and perimeters of rectangles using the concept of…
A: Program description: l and b are the user input integer variables used to take the values of length…
Q: Write a C++ code to read the values for the objects created for your classes. Then add the object of…
A: Friend function is a function which is not the member of the class instead of that it can access…
Q: rewrite the following class code to make employeeType as an abstract class, if you know that both…
A: In C++, an abstract class is one that contains one or more than one pure virtual function (a…
Q: Define an abstrat super class called Employee that contains a name (String), a social security…
A: class person { private String name; person(String s) {…
Q: Classes and operator overloading Define a class for complex numbers. A complex number is a number of…
A: C++ Code:#include<iostream.h> #include<conio.h> class complex { int a,b;…
Q: 2. Suppose animal is a class that defines the basic properties of an animal. Draw a class hierarchy…
A: Given, To implement Hierarchy inheritance
Q: Write the definitions of the member functions of the class calendarType (designed in Programming…
A: Member function: A member function of a class is a function that has its definition or its prototype…
Q: An electricity board charges the following rates to domestic users to discourage large consumption…
A: Since no programming language is mentioned, I am using java. Code: class Electricity{ int units;…
Q: Define two class types: Student and Graduate, where Graduate inherits from St udent. Class Student…
A: Sample Response: //C++ programming language//Tested on CodeBlock IDE#include <iostream>using…
Q: Using the information given above, create the following three classes. a. A parent class named…
A: C++ Code: #include <iostream>using namespace std; class Person{ private: string…
Q: Write an abstract class Shape with a pure virtual function Area to calculate the area shape. The…
A: We need to define the Shape, Circle, Triangle, Square classes as per the given description.
Q: write a phyton code: 1- define a class CommissionEmployee that: a. has a firstName, lastName,…
A: Here you go:
Q: C++ QUESTION 2. Give a definition for a class InternationalStudent that is a derived class of the…
A: The answer is as follows.
Q: c++ Implement a BankAccount class.
A: //C++ Program: #include<iostream.h>#include<conio.h>#include<string.h>class…
Q: .An electricity board charges the following rates to domestic users to discourage large consumption…
A: The main objective of the program is to create a c++ program with two classes called Electricity and…
Q: . Write a program having a base class Student with data members rollno, name and Class define a…
A: Actually, program is a executable software that runs on a computer.
Q: Using Python, create a program that has the following classes: Point - Just like in the lecture,…
A: Solution - Programming language used: Python All solution steps are included in program code as…
Q: Consider the following declarations: class xClass { public: void func(); void print() const ; xClass…
A: a. The constructor name is the same as the class name. In the given code, we have 2 constructors,…
Q: create a uml class diagram on this code: from abc import ABC, abstractmethod class…
A: ABC implementation is not given and thus just class implementation is shown
Q: Write a program that defines a class Employce with the following members as shown in the bellow UML…
A: print method will print all the information like name, id, salary
Q: Write a Java programs to: 1. 1. Create a class called Student with four (4) private member…
A: GIVEN: Create a class called students with 4 private member variables, name quiz midterm, and…
Q: c++ Implement a BankAccount class. BankAccount must have the following members: A member…
A: Code: #include<iostream>#include<stdio.h>#include<string.h> using namespace std;…
Q: creat a c++ project that Consider the following definition of a class. class displayClass { public:…
A: Part (a): The function prototype to overload the assignment operator (=) for the class…
Q: Example 10-10 defined a class personType to store the name of a person. The member functions that we…
A: #include <iostream>using namespace std; class PersonType{ string firstName=""; string…
Q: 6. Write an abstract class “Student” that has the attribute “name”, “id”, “cgpa”, totalFees.…
A: Actually, Java is a high level programming language. And also object oriented It Is a platform…
Q: Write a C++ program that implements the following class hierarchy. Bill Electicity Bill Where there…
A: Step 1 : Start Step 2 : Create a base class called Bill with data members and member functions…
Q: An electricity board charges the following rates to domestic users to discourage large consumption…
A: C++ program source code //main.cpp#include<iostream>using namespace std;//class…
Q: Q4. In a restaurant, whenever customers visit, they are provided with items from two categories, one…
A: Source codeBattery classpackage com.company;public class Battery { //instance variable…
Q: An instance of an abstract class is made by using the keyword 'new'. true or false
A: An instance of an abstract class is made by using the keyword 'new' :
Q: Given the following partial class definition: public class A1 { public int x; private int y;…
A: Subclass: A class is said to be a subclass of another class if it is derived from that class. For…
Q: Write a program having a base class Student with data members rollno, name and Class define a member…
A: The code for the given problem is written below in c++ language: Code: #include <iostream>…
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: Suppose, we have two related (child) classes named Doctor and Patient. Data members required by each…
A: As you have not mentioned the programming language to be used but description is showing that you…
Q: Write the definitions of the member functions of the class calendarType (designed in Programming…
A: Given:
Q: Write a program having a base class Student with data members rollno, name and Class define a member…
A: Inheritance is a feature of object-oriented programming language in which one class acquires the…
Q: Write a C++ Program to create a class sample with private members' length and breadth. Define a…
A: /* C++ program for class sample(having lendth and breadth as private menmbers, and constructor that…
Q: Write a Program to define a Television class, with member variables o String brandName; o String…
A: In Step 2, you will get the java code. In Step 3, you can see the output.
Q: C++ Shape is an abstract class with a pure virtual function: Area(). (2) Circle is…
A: I have resolved the error in the code:- #include <iostream>using namespace std;class Shape{…
Q: 10. Write the definitions of the member functions of the class a. calendarType (designed in…
A: Solution:
Q: Consider a class "Fan" with two integer data members, "state" (0/1 i.e. on or off) and "speed". 1.…
A: UML class diagram of Fan class: Where state and speed are private data members of fan class. The…
Q: Given the below program, explain why the bold text below is INVALID. abstract class Employee(…
A: Here in the given code, we have an abstract class named Employee with one abstract method…
Q: Define two class types: Student and Graduate, where Graduate inherits from Student. Class Student…
A: Code: #include <iostream>using namespace std;class Student{ protected: int id;…
Step by step
Solved in 2 steps with 1 images
- Create a program that has the following classes: Point - Just like in the lecture, with attributes x and y set to 0 by default. Circle - Contains two attributes, center and radius. center is of type Point defined above (initialize a Point instance for this), while radius is set to 0 by default. The program must have the function point_in_circle(c, p) where c is a Circle and p is a Point. The function returns True if the point is within the circle, and False otherwise. You may use the math module (and nothing else) if necessary. You may also create other functions that can help you code the main function much easier. Example usage # Initialize a circle with center at (0, 0) and radius 1 (unit circle). c = Circle() c.center.x, c.center.y, c.radius = 0, 0, 1 # Initialize a point located at (1, 1) p = Point() p.x, p.y = 1, 1 # This returns False since (1, 1) is outside the circle point_in_circle(c, p)Define a class for complex numbers. A complex number is a number of the form a + b*i where for our purposes, a and b are numbers of type double, and i is a number that represents the quantity √-1. Represent a complex number as two values of type double. Name the member variables real and imaginary. (The variable for the number that is multiplied by i is the one called imaginary.) Call the class Complex. Include a constructor with two parameters of type double that can be used to set the member variables of an object to any values. Include a constructor that has only a single parameter of type double; call this parameter realPart and define the constructor so that the object will be initialized to realPart + 0*i.Include a default constructor that initializes an object to 0 (that is, to 0 + 0*i).Overload all the following operators so that they correctly apply to the type Complex: ==, +, −, *, >>, and <<. You should also write a test program to test your class. Hints: To add…Write a program in Java for the university consisting of the following categories: A mere Person classification contains the following variables:String name The person's name. 1int id id number. 2Write a constructor that receives the variables and a function (ID int , name String(add) whereYou receive the person's name and ID number and assign them. Write the Students class that inherits from the Person class containing the variablesnext:String Specialization The student's specialization. 1double gpa student average. 2Write a constructor that accepts the variables. (Two and a half degrees). Write the Employee class that inherits from the Person class containing the variablesnext:String jop The job name. 1int salary 2Write a constructor that accepts the variables. Create an interface for the program as shown in the following image
- Write a program that does the following: 1-Define two classes Teacher and Department. Each Teacher has a department object as follow: [3 points] class Department{ int dno; char *name; //add data member to count number of departments automatically public: //add required methods here //define print function that prints all details of department. Note that print function is NOT function member of class Department }; class Teacher{ const int SSN; char *name; Department d; public: //add all required methods //define print function that prints all details of Teacher. Note that print function is NOT function member of class Teacher } 2-inside main do the following: a) create array of 5 Teachers. add all required details for each object inside a loop.(do NOT use cin>>) b)use print function for department and use print function for student. c)define and use a function FindTeachers that takes the array of Teachers and name of department. Then the function returns a list of all Teachers…We discussed in the class that during the design, you may need a class that serves as an interface for its derived classes, but you would not create any instance of that class. Such a class is called an abstract class. The UML class diagram shown below shows a class hierarchy starting from the Vehicle class which is an abstract class. Write a program to implement this class hierarchy such that the given code in the main function runs without error. Vehicle Bus Car Truck IntraCityBus InterCityBus int main() { Vehicle* V[] = { new Bus, new Car, new Truck, new IntraCityBus, new InterCityBus }; for (int i = 0; i < 5; i++) { cout<< V[i]->move() <<endl; } return 0; } Your program should produce an output as the following: Bus: Moves to carry a large number of people Car: Moves to carry a small number of people Truck: Moves to transport goods Intra-City Bus: Intra-City Bus: Moves to carry a large number of people between two areas of a city Inter-City Bus:…Given the base class Book, define a derived class called Encyclopedia. Within the derived Encyclopedia class, define a print_info() method that overrides the Book class' print_info() method by printing not only the title, author, publisher, and publication date, but also the edition and number of volumes. Ex: If the input is: The Hobbit J. R. R. Tolkien George Allen & Unwin 21 September 1937 The Illustrated Encyclopedia of the Universe James W. Guthrie Watson-Guptill 2001 2nd 1 the output is: Book Information: Book Title: The Hobbit Author: J. R. R. Tolkien Publisher: George Allen & Unwin Publication Date: 21 September 1937 Book Information: Book Title: The Illustrated Encyclopedia of the Universe Author: James W. Guthrie Publisher: Watson-Guptill Publication Date: 2001 Edition: 2nd Number of Volumes: 1 python code to be used: class Book: def __init__(self, title, author, publisher, publication_date):…
- // Defines a base class named Customer // And a child class FrequentCustomer who receives a discount // Main program demonstrates a customer of each type using System; public class DebugTen01 { public static void Main() { Customer aRegularCustomer = new Customer(); FrequentCustomer aFrequentCustomer = new FrequentCustomer(); aRegularCustomer.CustNum = 2514; aRegularCustomer.CustBalance = 765.00; aFrequentCustomer.CustNum = 5719; aFrequentCustomer.CustBalance = 2500.00; aFrequentCustomer.DiscountRate = 0.15; WriteLine("\naRegularCustomer #{0} owes {1}",aRegularCustomer.CustNum,aRegularCustomer.CustBalance.ToString("C2")); WriteLine("\naFrequentCustomer #{0} would owe {1} without the discount",aFrequentCustomer.CustNum,aFrequentCustomer.CustBalance.ToString("C2")); double newBalance = (1 - aFrequentCustomer.DiscountRate) * aFrequentCustomer.CustBalance; WriteLine("...with {0} discount,…Write a class definition that creates a class called leverage with one private data member, crowbar, of type int and one public function whose declaration is void pry(). Opp JavaTake this the Java Gringrots problem below turn it into a running program. where the main should find out how many galleons are from 100,000 knuts. : " Write a Java program using a class identified as Gringots.This Java class has a main, and the following protected member functions: Member function galleons2Sickles has an integer parameter value, and returns an integer value*17Member function sickles2galleons has an integer parameter value, and returns an integer value / 17Member function sickles2nuts has an integer parameter value, and returns an integer value*29Member function knuts2sickles has an integer parameter value, and returns an integer value/29 Member function Galleons2Knuts has an integer parameter value, and then uses member functions Galleons2Sickles and Sickles2Knuts to convert, and then returns the integer. Member function Knuts2Galleons has an integer parameter value, and then uses member functions Knuts2Sickles and Sickles2Galleons to convert, an dthen returns the…
- C++ is a programming language that can be used to Make a program that calculates the volume of different containers. Cylinder will be the base class, and its derived classes, also known as child classes or sub-classes, will be constructed. Create a parent class, Cylinder, first. Make a constant for pi, as you'll need it for any containers that aren't square. For the members, use protected. Finally, add a public function to control the volume. V = pi * (r2) * h is the formula.Using Python, create a program that has the following classes: Point - Just like in the lecture, with attributes x and y set to 0 by default. Circle - Contains two attributes, center and radius. center is of type Point defined above (initialize a Point instance for this), while radius is set to 0 by default. The program must have the function point_in_circle(c, p) where c is a Circle and p is a Point. The function returns True if the point is within the circle, and False otherwise. You may use the math module (and nothing else) if necessary. You may also create other functions that can help you code the main function much easier. Example usage # Initialize a circle with center at (0, 0) and radius 1 (unit circle). c = Circle() c.center.x, c.center.y, c.radius = 0, 0, 1 # Initialize a point located at (1, 1) p = Point() p.x, p.y = 1, 1 # This returns False since (1, 1) is outside the circle point_in_circle(c, p) hint: apply "classes" conceptWrite Java classes to solve the following problem: A company has two types of employees. These are called Exempt and NonExempt. Exempt means the employee is not eligible for overtime pay and is paid a fixed amount each pay period. NonExempt means the employee is paid by the hour and receives 1.5 times the hourly rate for hours worked over 40. Each Employee has an id number which is a string. They also have a name. Employee should be an abstract class with the member variables described in number 2. Employee should have an abstract method called findPay, a toString method, and it should implement the Comparable interface. Use alphabetical order of id number to determine less than, greater than, and equal to. The toString method should produce a string like the following: Emp: ID: 4590 Emp Name: Fred Jones Employee should have an equals method. Define two employees to be equal if they have the same name and the same id number. Provide accessor and mutators for Employee. NonExempt should…