(HugeInt Class) A machine with 32-bit integers can represent integers in the range of approximately –2 billion to +2 billion. This fixed-size restriction is rarely troublesome, but there are applications in which we would like to be able to use a much wider range of integers. This is what C++ was built to do, namely, create powerful new data types. Consider class HugeInt of Figs. 18.17–18.19. Study the class carefully, then answer the following:
- Describe precisely how it operates.
- What restrictions does the class have?
- Overload the * multiplication operator.
- Overload the / division operator.
- Overload all the relational and equality operators.
[Note: We do not show an assignment operator or copy constructor for class HugeInt because the assignment operator and copy constructor provided by the compiler are capable of copying the entire array data member properly.]
Fig. 18.17 HugeInt class definition.
Fig. 18.18 HugeInt member-function and friend-function definitions.
Fig. 18.19 HugInt test program.
Want to see the full answer?
Check out a sample textbook solutionChapter 18 Solutions
MYPROGRAMMINGLAB WITH PEARSON ETEXT
- 7. using c++, Write a void function that accepts an integer array a and a integer SizeA, and an integer n, and adds n to every element in that array. Be sure to develop an appropriate name for your function.arrow_forwardImplement the following in C++: 1) Differentiate a given function with respect to x. The input will consist of only one line, given in the file input.txt. The input will be just a power, exponential, logarithmic, hyperbolic, trigonometric or an inverse trigonometric function of x. The output should be displayed in the terminal.arrow_forwardSolve the problem in C++ (Geometry: find the bounding rectangle) A bounding rectangle is the minimum rectangle that encloses a set of points in a two-dimensional plane, as shown in Figure 11.9d. Write a function that returns a bounding rectangle for a set of points in a two-dimensional plane, as follows: const int SIZE = 2; Rectangle2D getRectangle(const double points[][SIZE]); Write another function that returns a pointer to the bounding rectangle as follows: Rectangle2D* getRectanglePointer(const double points[][SIZE]); The Rectangle2D class is defined in Programming Exercise 11.9. Write a test program that prompts the user to enter five points and displays the bounding rectangle’s center, width, and height. Sample Run Enter five points: 1.0 2.5 3 4 5 6 7 8 9 10 The bounding rectangle’s center (5.0, 6.25), width 8.0, height 7.5arrow_forward
- [C PROGRAMMING] Write a program in C: 1. The circle has two data members, a Point representing the center of the circle and a float value representing the radius as shown below. typedef struct{ Point center; float radius; }Circle; Implement the following functions: a. float diameter(Circle circ); //computes the diameter of a circle. b. float area(Circle circ); //computes for area of a circle c. float circumference(Circle circ);//computes for the circumference of a circlearrow_forward( In c++and oop ) without using vectors or data structure . Create a class IntegerSet for which each object can hold integers in the range 0 through 100. A set is represented internally as an array of ones and zeros. Array element a[ i ] is 1 if integer i is in the set. Array element a[ j ] is 0 if integer j is not in the set. • The default constructor initializes a set to the so-called “empty set,” i.e., a set whose array representation contains all zeros. • Provide member functions for the common set operations. For example, provide a unionOfSets member function that creates a third set that is the settheoretic union of two existing sets (i.e., an element of the third set’s array is set to 1 if that element is 1 in either or both of the existing sets, and an element of the third set’s array is set to 0 if that element is 0 in each of the existingsets). Provide an intersectionOfSets member function which creates a third set which is the set theoretic intersection of two existing sets…arrow_forward(Answers needs to be in pseudo-code, not in C++ ) Question Workspace a. The Downdog Yoga studio offers five types of classes, as shown in the Table Attached. Design a program that accepts a number representing a class and then displays the name of the class. b. Modify the Downdog Yoga Studio program so that numeric class requests can be entered continuously until a sentinel value is entered. Then display each class number, name, and a count of the number of requests for each class.arrow_forward
- (python) 9. Create a function based on the following information: You are given two strings with words separated by commas. Try to find what is common between these strings. The words in the same string don't repeat. Your function should find all of the words that appear in both strings. The result must be represented as a string of words separated by commas in alphabetic order. Input: Two arguments as strings. Output: The common words as a string. Return: Nothing is returnedarrow_forwardQuestion #2: (5 Points). Write a function in C++ which accepts a 2D array of integers and its size as arguments and displays the elements of middle row and the elements of middle column. [Assuming the 2D Array to be a square matrix with odd dimension i.e. 3x3, 5x5, 7x7 etc...] Example, if the array contents is 3 5 4 7 6 9 2 1 8 Output through the function should be : Middle Row :769 Middle column : 5 6 1arrow_forward(Answers needs to be in the most simple pseudo-code, not in C++ ) Question Workspace a. The Downdog Yoga studio offers five types of classes, as shown in the Table Attached. Design a program that accepts a number representing a class and then displays the name of the class. b. Modify the Downdog Yoga Studio program so that numeric class requests can be entered continuously until a sentinel value is entered. Then display each class number, name, and a count of the number of requests for each class.arrow_forward
- (JAVA) Create a two-dimensional array of type double to contain the three different SD Marks (JD521, PRG521, and IP521) for six different students. A single array of type String must be used to store the student names (Maxwell, Carl, Gerhard, Paul, James, and Cena). Allow a user to enter in a number, ranging from 1 to 6, which will represent the student position in the table MCSD max and present the marks for each respecting module. The program can only stop when the user enter a number greater than 6. Printout the student name including the JD521, PRG521, and IP521 max, the total of marks and the average of all marks. Use a condition statement to decide that the student has passed or not (Pass rate is 70). The programming language is java Student name JD521 PRG521 IPG521 Maxwell 80 65 70 Carl 95 70 65 Gerhard 87 80 73 Paul 65 45 60 James 45 87 65arrow_forward[C++ Programming] Please solve just #3. Please do not copy other sources in Chegg or other sites. Please write new code.arrow_forward(JAVA) This work must use object orientation, inheritance, and java collections, such as HashTable and Lists. The program to be developed must allow the registration of all the subjects of the course, as well as their prerequisites, and recommended sequence. Allow a student to be registered and then, as the student completes courses, inform the recommended sequence of courses. Functionalities: Register subjects, prerequisites (other subjects), areas (software engineering, machine learning, ...) and type (basic, elective group 1, elective group 2), and schedule Register recommended sequence It is suggested for the two cases above that the registration is in the code to avoid rework Allow student registration (name, area of interest: software engineering, machine learning, ...) Allow the student to report the course taken, with a grade Evaluate subjects taken by the student and inform which ones could be taken in the following semester, setting up a schedule for the same Allow…arrow_forward
- 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