C++
question 1
Monitor class header file: Monitor.h
Instructions:
1. Code the class specification file and name it as Monitor.h. You can code the constructor initialization steps in-line. The rest of the member functions should just be prototypes.
The class specification should define the prototypes of each functions.
Class name: Monitor
Private Member Attributes:
- string brand
- string model
- int width (px)
- int height(px)
- int ppi
- double refreshRate (hz)
- char speakers (Y/N)
- int ports (no. of ports)
- string portType (list of port types separated by commas)
Public Member Inline Functions
- Default Constructor with no parameters will initialize all numeric variables to 0.
- Constructor that accepts 3 int parameters for width, height, ppi. This constructor defaults the brand to "Generic", model to "Basic", the refreshRate to 60, speakers to 'N', ports to 1, and portType to "HDMI".
- Destructor (empty destructor)
Public Member Functions as Prototypes:
- Prototype for Setters (Mutators) for each member attribute that takes parameter for the attribute and returns no value.
- Prototype for Getters (Accessors) for each member attribute returns the data type as specified in the attribute list.
- Prototype for getScreenSize() function that calculates and returns the diagonal size of the monitor in inches. Be sure the data types will not demote numbers in the calculations. Use the formula:
Use: sqrt() and pow(x,y) functions
4. Prototype for listMonitor() that takes no parameter and no return value but generates cout of the the Monitor as:
Brand: Acer,Model: H243H,Screen size (pixels) 1920x1080 @ 70ppi, (diagonal) "result of getScreenSize"
Trending nowThis is a popular solution!
Step by stepSolved in 5 steps with 2 images
- c++ clasesarrow_forwardThe class implementation: The Account class) Design a class named Account that contains: A private int data field named id for the account (default 0). A private double data field named balance for the account (default 0). A private double data field named annuallnterestRate that stores the urrent interest rate (default 0). Assume all accounts have the same interestarrow_forward// CLASS PROVIDED: sequence (part of the namespace CS3358_FA2022)//// TYPEDEFS and MEMBER CONSTANTS for the sequence class:// typedef ____ value_type// sequence::value_type is the data type of the items in the sequence.// It may be any of the C++ built-in types (int, char, etc.), or a// class with a default constructor, an assignment operator, and a// copy constructor.//// typedef ____ size_type// sequence::size_type is the data type of any variable that keeps// track of how many items are in a sequence.//// static const size_type DEFAULT_CAPACITY = _____// sequence::DEFAULT_CAPACITY is the default initial capacity of a// sequence that is created by the default constructor.//// CONSTRUCTOR for the sequence class:// sequence(size_type initial_capacity = DEFAULT_CAPACITY)// Pre: initial_capacity > 0// Post: The sequence has been initialized as an empty sequence.// The insert/attach functions will work efficiently (without// allocating…arrow_forward
- The following class definitions and function definitions should be used to help you finish the exam. train.h: car.h: #ifndef CAR_H #define CAR_H using namespace std; class Car #include "car.h" using namespace std; #ifndef TRAIN_H #define TRAIN_H class Train { private: Car* tHead; Car* tTail; public: Train(); -Train(); void addcarBack(Car *); void deleteFirstcar(); void removeFirstcaróftype(const string &); { private: string name; double maxSpeed; public: Car* nextcar; public: car(); Car(string); double getMaxspeed () const; string getName() const; void setName(const string &); }; #endif // Display list car by car void display() const; }; #endif Part of train.cpp: // addcarBack logic: if (traincarsHead == 0) { traincarsHead = toAdd; traincarsTail = toAdd; else { traincarstail->nextcar = toAdd; traincarsTail = toAdd;arrow_forwardJ4va prgmarrow_forwardfunctions return the value of a data member. A. Accessor OB. Member C. Mutator OD. Utilityarrow_forward
- // TYPEDEFS and MEMBER CONSTANTS for the sequence class:// typedef ____ value_type// sequence::value_type is the data type of the items in the sequence.// It may be any of the C++ built-in types (int, char, etc.), or a// class with a default constructor, an assignment operator, and a// copy constructor.//// typedef ____ size_type// sequence::size_type is the data type of any variable that keeps// track of how many items are in a sequence.//// static const size_type DEFAULT_CAPACITY = _____// sequence::DEFAULT_CAPACITY is the default initial capacity of a// sequence that is created by the default constructor.//// CONSTRUCTOR for the sequence class:// sequence(size_type initial_capacity = DEFAULT_CAPACITY)// Pre: initial_capacity > 0// Post: The sequence has been initialized as an empty sequence.// The insert/attach functions will work efficiently (without// allocating new memory) until this capacity is reached.// Note: If Pre is not…arrow_forwardplease assist me C++ language you are the owner of a pet store and you want to create a database of the different types of pets you sell you will create a base class called Pet and will include the following member variables: gender size (small, medium, or large) trained (yes or no) age long haired (yes or no) create two constructors default will initialize member variable with blanks or zeros second constructor will assign parameter values to each variable create your mutator functions create your accessor functions and save your Pet.h file create a new header file for dogs: dog.h it will be a derived class of Pet.h it will inherit the public functions of Pet.h it will have its own member variable breed (ie: beagle, collie, etc.) create the .cpp file, pet store create two instances of dog use the default constructor for the first dog use the second constructor for the second dog display both dog's data labeling each line report should look something like this…arrow_forwardC code Blocks Select all of the code segments that are the correct way to define a variable class as an array of 185 personal structures. struct personal { int id; // id numberchar name[80];}; Options: a .personal class[185]; b. struct personal class[185]; c. typedef struct personal classStruct;classStruct class[185]; d. typedef class[185];arrow_forward
- Double Bubble For this exercise you need to create a Bubble class and construct two instances of the Bubble object. You will then take the two Bubble objects and combine them to create a new, larger combined Bubble object. This will be done using functions that take in these Bubble objects as parameters. The Bubble class contains one data member, radius_, and the corresponding accessor and mutator methods for radius_, GetRadius and SetRadius. Create a member function called CalculateVolume that computes for the volume of a bubble (sphere). Use the value 3.1415 for PI. Your main function has some skeleton code that asks the user for the radius of two bubbles. You will use this to create the two Bubble objects. You will create a CombineBubbles function that receives two references (two Bubble objects) and returns a Bubble object. Combining bubbles simply means creating a new Bubble object whose radius is the sum of the two Bubble objects' radii. Take note that the CombineBubbles function…arrow_forwardTwo data members: feet(int) and inches(float) Two overloaded constructors: one that takes no argument and the other that takes two arguments. Zero argument constructor initializes data members from 0 whereas two argument constructor initializes data members from the passed arguments. Two getters and two setters corresponding to two data members. A member function named toDecimal that converts a distance to decimal, e.g., if a distance equals 2 feet and 6 inches then it would become 2.5 in decimal. A member function named toString that returns a string representation of a distance, e.g., if a distance equals 2 feet and 6 inches then the corresponding string representation should be 2’-6”. by using C++arrow_forwardC++ language patient.h /*preventing multiple inclusion of header files using#ifndef and #define directives */#ifndef PATIENT_H#define PATIENT_H#include<iostream>using namespace std;class patient{ //declaring instance variables private: string firstName; string lastName; int id; public: //default constructor declaration patient(); //parameterized constructor declaration patient(string fName,string lName,int pId); //print() function declaration void print(); //setter functions declaration void setFirstName(string fName); void setLastName(string lName); void setId(int pId);};#endif patient class implementation patient.cpp #include "patient.h"//default constructor implementationpatient::patient(){ firstName=""; lastName=""; id=0;}//parameterized constructor implementationpatient::patient(string fName,string lName,int pId){ firstName=fName; lastName=lName; id=pId;}//print function…arrow_forward
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY