Trusted by Students Everywhere
Why Choose Us?
0% AI Guarantee

Human-written only.

24/7 Support

Anytime, anywhere.

Plagiarism Free

100% Original.

Expert Tutors

Masters & PhDs.

100% Confidential

Your privacy matters.

On-Time Delivery

Never miss a deadline.

1) Create a class Rectangle

Computer Science Jan 26, 2022

1) Create a class Rectangle. The class has attributes length and width, each of which defaults to 1. It has member functions that calculate the perimeter and the area of the rectangle. It has ser and get functions for both length and width. The set function should verify that length and width are each floating-point numbers larger than 0.0 and less than 20.0. Write a driver program to test your class. 2. Create a more sophisticated Rectangle class than the one you have created in Exercise 1. This class stores only the Cartesian coordinate of the four corners of the rectangle. The constructor calls a ser function that accepts four sets of coordinates and verifies that each of these is in the first quadrant with no single x or y coordinate larger than 20.0. The set function also verifies that the supplied coordinates do, in fact, specify a rectangle. Member functions calculate the length, width, perimeter and area. The length is the larger of the two dimensions. Include a predicate function square that determines if the rectangle is a square. Write a driver program to test your class. (Note: a predicate function is a function to test the truth of some conditions, for example. to test whether a rectangle is a square; if yes, the predicate function returns true, otherwise returns false.) 3. The following is a class Time declaration saved in a file named Timel . h. // Declaration of Time class. #ifndef TIME1_H #define TIME1_H class Time { public: Time (int = 0, int = 0, int = 0) ; // default constructor void setTime (int, int, int) ; // set hour, minute, second void printMilitary () ; // print military time format void printStandard () ; // print standard time format private: int hour; // hour from 0 to 23 int minute; // minute from 0 to 59 int second; // second from 0 to 59 #endif The class Time above prints out the standard time and the military time given the time in hour, minute and second. For example, if hour = 13, minute = 27 and 1 second = 6, then military time is 12:27 and the standard time is 1:27:06 PM. If the hour, minute and second are not specified, the default military time is 00:00 and the default standard time is 12:00:00 AM. Implement the class Time definition and write a driver program to test the implementation of the class Time.

Expert Solution

For detailed step-by-step solution, place custom order now.
Need this Answer?

This solution is not in the archive yet. Hire an expert to solve it for you.

Get a Quote
Secure Payment