C++, ACCORDING THE VEHICLE HEADER, FILL THE PART 1 OF THE CODE #ifndef _Vehicle_hh_ #define _Vehicle_hh_ class Vehicle { private: float speed; float mile; public: Vehicle();
Q: Write in C++ Language. (Employee Record): Create a class named 'Staff' having the following…
A: Class Staff is created with data members and member functions: id of type int, name, address and…
Q: What do the terms "static data member" and "static memberfunction" mean to you?
A: Class members that are specified with static keywords are known as "static data members" in…
Q: Construct an Airlines Reservation System (ARS) program for a flight travel agency. The ARS must keep…
A: Source Code main.cpp #include <iostream>#include "bluesky.cpp"using namespace std; int…
Q: Write down a C++ Program that creates a class called Student. The data members of the class are: 1.…
A: In the java program, import the required libraries. Then, create the class as per the name specified…
Q: Using C# Language: Programming PLO 3 Measured: Create control structures, methods with the…
A: The, code has given below:
Q: In c++ Create an object-oriented program that manages bank account. Bank Account Manager Main Menu…
A: The function overriding is the most well-known element of C++. Essentially function overriding…
Q: Create a class time24, each object is a value represented the time of day in the form hours, minutes…
A: A C++ program that satisfies the given criteria is as follows, File name: “main.cpp” #include…
Q: Hospital Class) Write a c++ class called 'Hospital' with Data Members: hospital name -string type-…
A: Q: Code the given problem
Q: How to decide if your variable
A: Q)How to decide if your variable should be declared as an enum type or any other data types? Support…
Q: Topical Information Use C++. This lab will help you practice with operator overloading (NOT mixed…
A: PROGRAM: #include <iostream> #include <string> #include <locale> using namespace…
Q: When a program that uses the constructor overloading is compiled, C++ compiler checks the number of…
A: Overloaded constructors essentially have the same name (name of the class) and different number of…
Q: C++ Program 1. Design a class that manages a Pet Food Company's quarterly summarized activity. It…
A: Step 1: In the header file, declare class PetFoodCompany with the specified data members and member…
Q: in c++ Create a class time24, each object is a value represented the time of day in the form hours,…
A: The program defines a class time24. The data member of the class are: hours of type int minutes if…
Q: In C++ please. This program is a two-part program. Both programs go together. Please do both parts:…
A: #include <iostream>#include<string>using namespace std;class ItemToPurchase{ private:…
Q: Write a program in C++ that declares two classes. The parent class is called Simple that has two…
A: A class is the fundamental building block of Object-Oriented programming. It's a user-defined data…
Q: 4. Default constructors are not mandatory to be written by user, explain the situation when default…
A: The default constructor does not accept any arguments. If the user don't specifically specify at…
Q: Write a program in c++ that has a class containing constructors and in the class create 5 functions…
A: Constructor is a method which has same name as that of class name The basic class looks as…
Q: in C++ Create a class person having 5 data members. • Name • Address • Cnic • Gender • Age All data…
A: Programming instructions: Include necessary header files. Create a class person. Create protected…
Q: Write a class Travel having two private data members (distanceCovered , Time) The class has three…
A: public class Box{ //declaring data members private double width; private double depth; private…
Q: C++ Program 1. Design a class that manages a Pet Food Company's quarterly summarized activity. It…
A: Accordingly , we have divided solution in 3 file : PetFoodCompany.h PetFoodCompany.cpp Main.cpp
Q: Define a base class shape that includes protected data members for area and volume of a shape,…
A: C++ code: #include <iostream>#include <cmath> using namespace std; //Define a base class…
Q: Any function written outside of a class has access to the private members of the class in which it…
A: Private is an access identifier which tells which class of function can access it.
Q: In C++ Design a class named QuadraticEquation for a quadratic equation . The class contains:…
A: #include <iostream>#include <cmath> using namespace std; class QuadraticEquation{…
Q: Write the c++ class interface code that is presented by the following UML diagram OOPstudent…
A: The following C++ code is based on given class diagram. Include necessary headers to program Make a…
Q: Static variables can't be declared inside a Local class.
A: The Answer is given below step.
Q: Test The Program The output should look exactly as follows: Food Name: Apples raw
A: Program approach:- Using the header file. Using the standard namespace I/O. Default constructor.…
Q: write c++ code for Design a class named Computer that holds the make, model, and amount of memory…
A: The class diagram and the runner code of the given program is provided in the next step.
Q: rite a OOP C++ program that declares two classes. The parent class is called Simple that has two…
A: #include <iostream>using namespace std;//parent classclass Simple{protected: int num1;…
Q: calFromCarb (double) calFromFat (double) calFromProtein (double) Use the data types in…
A: Q PLease! IN C++ Write A Class Declare a class/struct named NutritionData that contains these…
Q: Do it in C++ (The MyPoint class) Design a class named MyPoint to represent a point with x- and…
A: Answer :
Q: A point in the x-y plane is represented by its x-coordinate and y-coordinate. Design a…
A: Constructor is a method which have same name as class name and whenever the instance is created,…
Q: PLease! IN C++ Write A Class Declare a class/struct named NutritionData that contains these…
A: #include<iostream>#include<string>using namespace std; class NutritionData{ private:…
Q: Exercise on class inheritance in C++. General requirements: • All data members must be declared as…
A: #include <iostream>#include <string.h>using namespace std; class BooleanVariable{…
Q: Write a C++ program that includes a class called PC. The private members of the class include the…
A: C++ language is a direct descendant of C programming language with additional features such as type…
Q: C++ Program Assignment 1: Inheritance Create a base class and also a class that is derived from the…
A: The main objective of the program is to demonstrate the inheritance using the two classes The below…
Q: Write a class in C++ named Employee that has the following member variables: name. A string that…
A: #include <iostream>#include "Employee.cpp" //include file where class is written using…
Q: • having no parameter – for setting values to zero or null. • having two parameters for assigning…
A: Algorithm: First we declare the class and default contructor Overload default constructor with a…
Q: Static variables can't be declared inside a local class.
A: A static variable is one that has been "statically" allocated, which means that its lifespan (or…
Q: can I get help writing this in c++ It is your job to create an object-oriented application that…
A: C++ is an objective oriented programming language and same has been used to solve the above…
Q: A be used in C++ to . function is not a member of the class, but has access to the private members…
A: The correct is( "friend function""protected ") ExplanationA friend functionality is able to access…
Q: In a programming language that binds variables to a specific data type if the variable is named in a…
A: According to the information given:- We have to find out In programming language binding variable to…
Q: Object oriented programming C++ Use Classes Write a C++ program in which each flight is required…
A: Define class Date in Date.h header file. - Declare two string variables for departure and arrival…
Q: please assist me c++ language 1, employee and productionwork classes design a class named…
A: Here is the C++ code with three different files: ----------Employee.h---------- #ifndef…
Q: PLease write the code in C++. Thank you so much. Write A Class Declare a class/struct named…
A: #include<iostream>#include<string>using namespace std; class NutritionData{ private:…
Q: In a programming language that binds variables to a specific data type if the variable is named in a…
A: In a programming language that binds variables to a specific data types if the variables is named in…
Q: (Write C++ Code) 1. Monitor class header file: Monitor.h Instructions: 1. Code the class…
A: Given: Monitor class - Monitor.cpp Instructions: Code the class cpp file and name it as Monitor.cpp.…
Q: Design a class named Rectangle to represent a rectangle. The class contains: • Two double data…
A: #include<iostream>using namespace std;//rectangle classclass Rectangle{ //data members double…
Q: (Write C++ Code) (computer science) 1. Monitor class header file: Monitor.h Instructions:…
A: You have asked multipart question so we will solve the three questions for you, those will be…
Q: This is for C++ only, and I will be using visual studio as a compiler. You can use dummy variables…
A: #include"stdafx.h" #include<iostream> #include<string> #include "CustomerData.h" using…
FOR C++, ACCORDING THE VEHICLE HEADER, FILL THE PART 1 OF THE CODE
#ifndef _Vehicle_hh_
#define _Vehicle_hh_
class Vehicle {
private:
float speed;
float mile;
public:
Vehicle();
Vehicle(float, float);
float getSpeed();
float getMile();
void setSpeed(float);
void setMile(float);
void print();
};
#endif
(DEFINE FUNCTIONS CORRESPONDING TO VEHICLE HEADER CLASS IN PART 1 BELOW)
#include "Vehicle.hh"
#include "Ship.hh"
#include <iostream>
using namespace std;
// *** DEFINE --VEHICLE-- FUNCTIONS FOR PART 1 ***
// *** DEFINE --SHIP-- FUNCTIONS FOR PART 2 ***
void reduceSpeed(Ship*, float);
void takePassenger(Ship*, int);
int main() {
return 0;
}
// reduce the speed of ship given in percentage (0 < percentage < 1).
void reduceSpeed(Ship *s, float percentage) {
// *** FILL THIS FUNCTION FOR PART 3 ***
}
// takes the number of passengers to the ship
void takePassenger(Ship *s, int pas) {
// *** FILL THIS FUNCTION FOR PART 4 ***
}
Trending now
This is a popular solution!
Step by step
Solved in 3 steps
- In C++ design a class named Triangle that extends GeometricObject. The class contains the following: Three double data fields named side1, side2, and side3 to denote three sides of the triangle. A no-arg constructor that creates a default triangle with each side 1.0. A constructor that creates a rectangle with the specified side1, side2, and side3. The constant accessor functions for all three data fields. A constant function named getArea() that returns the area of this triangle. A constant function named getPerimeter() that returns the perimeter of this triangle. Submit the following: Draw the UML diagram that involves the classes Triangle and GeometricObject. Implement the class. Write a test program that prompts the user to enter three sides of the triangle, enter a color, and enter 1 or 0 to indicate whether the triangle is filled. The program should create a Triangle object with these sides and set the color and filled properties using the input. The program should display the…You must use C++ as the programming language. Please do the following:Create a program that illustrates C++ classes. Your program should do the following:Write a class named Car that has the following member variables: year (An int that holds the car’s model year. The year must be between 1900-2030 (inclusive)). make (A string that holds the make of the car.) speed (An int that holds the car’s current speed. The speed must be 0 or greater. )In addition, the class should have the following member functions: Constructor - The constructor should accept the car’s year and make as arguments and assignthese values to the object’s year and make member variables. The constructor should initializethe speed member variable to 0. Notice that this constructor will have 2 parameters: one forthe year and one for the make of the Car. When you define a Car object, you will need to send the two arguments the constructor isexpecting:Car myCar(2002, “Jetta”); In the constructor you need to assign a…In C#, how would you write (2) programmer defined methods as described below: Method #1 (GreetingGeneric) — a type void programmer defined method does not require any parameters. It should output a generic greeting line for a letter. For example: "Dear Customer", "Dear Student", etc. Method #2 (GradeMessage) — a type void programmer defined method that has (3) parameters; (string, string, double) for (name, assignment, and grade) and should output the passed parameters in sentence format: GradeMessage("Jimmy", "Midterm Exam", 79.5) would output: Jimmy took the Midterm Exam and got 79.5 points. The Main() method for this program should: call Method #1 to output the generic greeting ask the user to enter a name, assignment, and grade and pass them to Method #2 for output. Input should only be done in the Main() method and output in the programmer-defined methods.
- C++ simple friend function.Create a C++ class called cube that calculates the volume of a cube. Use appropriate accessors (getters) and mutators (setters), constructors, etc. Your program must also include a friend function that will sum the volume of two cube class instances.Output the individual volumes of each of the two cube classes and then the total volume from the friend function. Example of friend funtion #include <iostream> using namespace std; class Box { double width; public: friend void printWidth( Box box ); void setWidth( double wid );}; // Member function definitionvoid Box::setWidth( double wid ) { width = wid;} // Note: printWidth() is not a member function of any class.void printWidth( Box box ) { /* Because printWidth() is a friend of Box, it can directly access any member of this class */ cout << "Width of box : " << box.width <<endl;} // Main function for the programint main() { Box box; // set box width…Exercise on class inheritance in C++. General requirements: • All data members must be declared as “private” • No global variable is allowed to be declared and used (constants are ok) • Methods within the class and the requested functions cannot have “cin” or “cout” but it should make use of parameters and return value instead unless it is stated explicitly. • “cin” and “cout” should be used in main() or any testing functions • Please make sure that you clearly show how the C++ class, its methods and all the functions are being called and print out its return value and its results properly Please answer the following questions. 1. Define a class named “BooleanVariable” that manages a variable name (string) and a boolean value (true or false). It should not have default constructor. The class must at least provide the following methods: - toString() method that can return a string in the following format: variable-name(variable-boolean-value) such as isSuccessful(true) -…Write a program in C++ object oriented programming Create a class Class1 with a string data member ‘paragraph’. Provide a constructor and getParagraph() method in the class. The constructor just assigns NULL to the data member. getParagraph() method must read a paragraph from user. The paragraph should contain at least 30 words. If there are less than 20 words, the program must ask user to enter paragraph again. Create another class Class2, and make it a friend of the class Class1. Provide a function getSubString(Class1 &obj1, int startIndex, int lastIndex) with return type string in the class Class2 which accepts an object of class Class1 (by reference) and two integers. The getSubString() function should return the substring starting from location startIndex and ending at location lastIndex. Class2 must also contain a store() function that stores the substring in a file. Print screenshot of substring stored in file as well. (Topics covered: File Handling, Friend Classes.
- Indicate whether each of the following C# programming language identifiers is legal or illegal. If it is legal, indicate whether it is a conventional identifier for a class. electricBill ElectricBill Electric bill Static void #ssn Ay56we Theater_Tickets 212AreaCode heightInCentimeters Zip23891 VoidPLease! IN C++ Write A Class Declare a class/struct named NutritionData that contains these private fields foodName (string) servingSize (int) calFromCarb (double) calFromFat (double) calFromProtein (double) Use the data types in parentheses for the fields. Note that you need to use the proper C++ syntax for the fields. Each field should have a comment documenting what it is for. Place one comment above each field. Add the public default constructor. Read the textbook for the syntax of the default constructor. Write the body of the default constructor inline. The default constructor initializes the fields so that the food name is an empty string and all other fields are 0 for int and 0.0 for double. Add public mutator member functions to set the fields. One mutator member function for each field. Each mutator member function's name should begin with the word 'set' followed by the field name with the first letter changed to uppercase. Each member function should have a comment above…In c++ please (The Rectangle class)Design a class named Rectangle to represent a rectangle. The class contains:• Two double data fields named width and height that specify the width and height of the rectangle.• A no-arg constructor that creates a rectangle with width 1 and height 1.• A constructor that creates a rectangle with the specified width and height.• The accessor and mutator functions for all the data fields.• A function named getArea()that returns the area of this rectangle.• A function named getPerimeter() that returns the perimeter.Implement the class. Write a test program that creates two Rectangle objects. Assign width 4 and height 40 to the first object and width 3.5 and height 35.9 to the second. Display the width, height, area, and perimeters of the first object and then the second object.
- in c++ Define a class named “Variable” that manages a variable name (string)and a description (string). It should not provide the default constructor.The class must at least provide the following methods:- toString() method that can return a string in the following format: VAR(<var-name>) DESC(<var-desc>) such as VAR(isSuccessful) DESC(successful flag indicator)- contains() that accepts a search string and it will return true if its variablename or the description contains that string (case-insensitive) and false otherwise.Show how this class being used to create objects and call all its methods and showhow they work.in c++ Define a new class named “Student” that must inherit from the given User class. This class manages student info: id (integer), name (string) and gpa (double). It must prevent the creation of a Student object with a negative ID or a GPA that is not between the range of 0.0 and 4.0 by generating a BadValueException error. This class will provide at least the following methods: toString method to return a string representation of the Student object in the format of “ID( <id> ) NAME( <name> ) GPA( <gpa> )” Such as ID(1234) NAME(John Smith) GPA(4.00) Note: the GPA must have 2 decimal places. isGPAGreater method that compares its gpa with another student’s gpa. It returns true if its gpa is greater than the other and false otherwise.Do it in C++ (The MyPoint class) Design a class named MyPoint to represent a point with x- and y-coordinates. The class contains: Two data fields x and y that represent the coordinates. A no-arg constructor that creates a point (0, 0). A constructor that constructs a point with specified coordinates. Two get function for data fields x and y, respectively. A function named distance that returns the distance from this point to another point of the MyPoint Type.Draw the UML diagram the class. Implement the class. Write a test program that creates two points (0, 0) and (10, 30.5) and displays the distance between them.Further create a class named ThreeDPoint to model a point in a three-dimensional space. Let ThreeDPoint be derived from MyPoint with the following additional features: A data field named z that represents the z-coordinate. A no-arg constructor that constructs a point with coordinates (0, 0, 0). A constructor that constructs a point with three specified coordinates. A…