Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Data Structure Programming (hand in C++ code only) Given the declaration of a class Point class Point public: Point (double-0.0, double#0.0); Point &setValue (double, double)a

Data Structure image text in transcribed
image text in transcribed
Programming (hand in C++ code only) Given the declaration of a class Point class Point public: Point (double-0.0, double#0.0); Point &setValue (double, double)a void print() const; private: double x, yi Write appropriate definition for the constructors and the function setValue and print. You should use the this pointer as the return value in the function setValue so that you can use the statement myObject.setValue(4,5) printo. The output of the function print is (4, 5). In you main function, create an object and call setValue(... .print0. Write a class named Date which has three private data: day, month, year, and two friend functions: operator and operator>In operator>> prompt user to input a date with format dd/mm/yyyy and then use strtok to separate the numbers and assign them to the data members. In operator> In + operator, the sum of a/b and c/d is (a"d+b c)bd. Inoperator, if the user enter 0 for the denominator, output error message and prompt user to type again (use while loop). In >and assign data for them. Then sum the two numbers and display the results. Sample output Enter two integers: 3 0 Error: the denominator cannot be 0. Try again Enter two integers: 23 Enter two integers: 3-4 a n (2 bonus marks) Add a private member function with function prototype void normalize() to normalize the values stored so that, after normalization, the denominator is positive and the numerator and 2/3 +-3/4 -1/12 4/-8 would be represented the same as -1/2. You must email me your code for this part. denominator are as small as possible. For example, after normalization

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

What were your most important educational experiences?

Answered: 1 week ago

Question

Which personal relationships influenced you the most?

Answered: 1 week ago