Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Using C++ and Visual Studios
Using your own creativity, make a set of class templates that have these features:
- For this class template, put everything in one place--do not declare the member functions and have separate definition of the member functions elsewhere. Keep them in one place.
- Include a private variable.
- Include a constructor that loads the private variable when constructed.
- Include a destructor that clears the private variable to zero.
- Include set and get functions to set and get the private variable.
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 3 steps with 1 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- PLease! In c++ Important requirements for all questions: • All data members must be declared as “private” • No global variable is allowed to be declared and used • Methods within the class and the requested functions cannot have “cin” or “cout” but it should make use of parameters and return value instead. • “cin” and “cout” should be done in main() or any testing functions • Make sure that you clearly show how the C++ class, its methods and all the functions are being called at least twice and print out its return value and its results properly. This is just a practice question.arrow_forwardHello, I am having trouble with this homework question for my c++ course. Implement a Rational Number class with the following specifications. Data members a) numerator and denominator Functions a) Constructors: 1) default constructor 2) single parameter constructor to create numerator/1 3) dual parameter constructor to create numerator/denominator 4) Use constructor delegation across all constructors. b) Accessors and Mutators for both data members. c) Static recursive GCD function using Euclid's algorithm. d) Static LCM function for two numbers. e) Reduce function simplify a rational number. This function modifies its calling object. f) Your program should work with the supplied driver program. Notes LCM (Least Common Multiple) This function returns the smallest multiple of a and b. Step 1: Multiply a and b to find a common multiple. Step 2: Divide the common multiple by the GCD of a and b. Step 3: Return the result of Step 2. Reduce: This function reduces a fraction to…arrow_forwardC- Create the sub class UsedBook that is derived from the super class Book and has the following instance variables, constructor, and functions: title ( String) isbn ( String) authors (String) publisher (String) edition ( int) published_year (int) price_new (double) // the price of the book if it is new age (int) // how old the book is in years Constructor that takes all of the above variables as input parameters. set/get functions calculate_price method // the price is calculated as price_new * (1- 0.10*age) print function that prints all information related to the old book. D- Create the Testing class that has the main method and does the following: aa- Use the constructor to create instance of NewBook class and name it as new. Call compute_price function. bb- Use the constructor to create instance of usedBook class and name it used. Call compute_price function. cc- Print the related information of new and used objects using print functions. Use this following code: class…arrow_forward
- Using C++ and Visual Studios Using your own creativity, make a set of class templates that have these features: For this class template, put everything in one place--do not declare the member functions and have separate definition of the member functions elsewhere. Keep them in one place. Include a private variable. Include a constructor that loads the private variable when constructed. Include a destructor that clears the private variable to zero. Include set and get functions to set and get the private variable.arrow_forwardC++ Assignment---This is an unfinished code please complete it. Make changes if necessary. Upvote for finished working code. Objectives • To apply knowledge of classes and objects Instructions Implement all of the following, each in a separate Visual Studio project (and/or solution). 1. Define a class called CounterType to implement a simple counter. The class must have a private field (data member) counter of type int. You must also provide methods (member functions), including the following: a. A constructor to set the counter to the value specified by the user b. A constructor to set the counter to 0 c. A method to allow the user to set the counter to a value they specify d. A method to increment the counter by 1 e. A method to decrement the counter by 1 Your code must ensure the value of counter is never negative. If the user calls a method to attempt to make the counter negative, set the counter to 0 and print out an error to the user (e.g., “The counter must not be negative.”) Do…arrow_forwardC++ coding project just need some help getting the code thank you!arrow_forward
- Important requirements for all questions: • All data members must be declared as “private” • No global variable is allowed to be declared and used • Methods within the class and the requested functions cannot have “cin” or “cout” but it should make use of parameters and return value instead. • “cin” and “cout” should be done in main() or any testing functions • Make sure that you clearly show how the C++ class, its methods and all the functions are being called at least twice and print out its return value and its results properly.arrow_forwardNeed help with a C++ commenting question: Indicate where the different constructors, assignment operator= and desctructor will run with a comment under the relevant line of code. Start in main and use the following tags to indicate the function that will run: Default constructor <object name>String constructor <object name>Copy constructor <object name>Assignment operatorDestructor <object name>Substitute the variable name for the object constructed or destructed. Use a comma to separate if multiple functions are run on a line. Code to comment on: #include <iostream> 2 using namespace std; 3 4 class Student { 5 public: 6 friend Student OutputDuplicate (Student obj); // friend function 7 8 Student (); // Default constructor 9 10 Student (string n); // String constructor 11 12 Student (const Student & obj); // Copy constructor 13 14 Student& operator= (const Student &…arrow_forwardHi, I am having trouble with this homework question for my C++ course 1. Implement a Student class. a. Create a class Student with the following private data members:1. name2. exam_1 grade3. exam_2 gradeb. Create all appropriate accessor and mutator functions.c. Assign appropriate access modifiers to insure encapsulation.d. Add a private calc GPA() function that calculates and returns the GPAbased upon the two exam grades.e. Add a public getGrade() function that: 1. Obtains the GPA from the private calc GPA() function.2. Returns a letter grade based upon the numerical GPA value.90 to 100 = A80 to 90 = B70 to 80 = C60 to 70 = D0 to 60 = F f. Test all functions use following main.int main(){Student a;a.setName("David");a.setExam1(90);a.setExam2(80);cout<<a.getName()<<endl;cout<<a.getExam1()<<endl;cout<<a.getExam2()<<endl;cout<<a.getGrade()<<endl;}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_forwardC++ please help me answer this question I will give you a good rating Thank you! Choose the correct answer to the question. Which of these is not a property of a class? Member variables and member functions may be public, protected, or private. A class may not use another class as the type for a member variable. The name of a member function for a class may be overloaded just like the name of an ordinary function. A function may have formal parameters whose types are classes. A function may return an object of a class. Choose the correct answer to the question.The copy constructor is executed... When one object is assigned to another object at its creation When objects are passed to a function using call by value When the function returns an object reference.b, c only a, b onlyAll of the abovearrow_forwardIn C++ Please: THE PROGRAM CANNOT CONTAIN -> OPERATORS! Create a class AccessPoint with the following: x - a double representing the x coordinate y - a double representing the y coordinate range - an integer representing the coverage radius status - On or Off Add constructors. The default constructor should create an access point object at position (0.0, 0.0), coverage radius 0, and Off. Add accessor and mutator functions: getX, getY, getRange, getStatus, setX, setY, setRange and setStatus. Add a set function that sets the location coordinates and the range. Add the following member functions: move and coverageArea. Add a function overLap that checks if two access points overlap their coverage and returns true if they do. Add a function signalStrength that returns the wireless signal strength as a percentage. The signal strength decreases as one moves away from the access point location. Represent this with bars like, IIIII. Each bar can represent 20% Test your class by writing a…arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education