subject

Your task will be to create a class called Distance, in the files distance. h and distance. cpp, which will involve a variety of operator overloads. A Distance object will store a quantity of distance in terms of miles, yards, feet, and inches. You will overload some basic operators for use with these objects including arithmetic, comparison, and insertion/extraction operators. These operators must work even for large distances (e. g. thousands of miles) and should not overflow the capacity of the storage variables (int) unless the number of miles is very close to the upper limit of int storage. Program Details and Requirements The Distance class must allow for storage of a non-negative quantity of distance in terms of miles, yards, feet, and inches using integer precision. All values should be non-negative. The data should always be maintained in a simplified form. For example, if you have 14 inches, this should be expressed as 1 foot and 2 inches. You should create appropriate member data in your class, all of which must be private.
Remember that there are 12 inches in a foot, 3 feet in a yard, and 1760 yards in a mile. The only limit on the number of miles is that imposed by int storage (e. g. ~2 billion for 32 bit int)
Public Interface
1. Constructors
The class should have a default constructor (no parameters) which should initialize the object so that it represents the distance 0.
The class should have a constructor with a single integer parameter which represents a quantity of inches. This should be translated into the appropriate notation for a Distance object. Note: this will be a conversion constructor that allows automatic type conversions from int to Distance. If the parameter is negative, default the Distance object to represent 0.
The class should have a constructor that takes 4 parameters representing the miles, yards, feet, and inches to use for initializing the object. If any of the provided values are negative, default the Distance object to represent 0. If any of the provided values are too high (e. g. 13 inches), simplify the object to the appropriate representation.
Examples: Distance t; Distance s (1234); // creates an object of 0 miles, 0 yards, 0 feet, 0 inches // creates an object of 0 miles, 34 yards, 0 feet, 10 inches

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 04:40
Amain idea is supported, explained, or expanded on with a numbers b. a concluding statement c. details d. a topic sentence. im e paragraphs reset nex next
Answers: 2
question
Computers and Technology, 22.06.2019 07:00
You will be given two character arrays of the same size, one will contain a number of ships. ships will move around the character array based on which way they are facing and the route they are on. routes are given in the other array. the route consists of '-' and '|' for straight paths, '\' and '/' for curves, and '+' for intersections. there are ships on these routes. ships always face a direction, '^' for up, '> ' for right, 'v' for down, and '< ' for left. any time the ships hit a '\' or a '/' it will turn as you would expect a ship to turn (e.g. a '^' that moves into a '/' will turn right). at an intersection, ships will always continue straight through. all ships move at the same speed, ships take turns moving and all ships move during one 'tick'. the one in the most top left goes first, followed by those to its right, then the ones in the next row. it iterates along the rows and then down the columns. each ship moves one space on its turn moving along the route. your function needs to return the position of the first collision between two ships and the number of ticks before the crash occurred.
Answers: 2
question
Computers and Technology, 23.06.2019 01:30
In deadlock avoidance using banker’s algorithm, what would be the consequence(s) of: (i) a process declaring its maximum need as maximum possible for each resource. in other words, if a resource a has 5 instances, then each process declares its maximum need as 5. (ii) a process declaring its minimum needs as maximum needs. for example, a process may need 2-5 instances of resource a. but it declares its maximum need as 2.
Answers: 3
question
Computers and Technology, 24.06.2019 07:30
Consider the folloeing website url: what does the "http: //" represent? a. protocal identifier. b. ftp. c. domain name d. resource name
Answers: 2
You know the right answer?
Your task will be to create a class called Distance, in the files distance. h and distance. cpp, whi...
Questions
question
Mathematics, 05.11.2020 07:20
question
Mathematics, 05.11.2020 07:20
question
Social Studies, 05.11.2020 07:20
question
Mathematics, 05.11.2020 07:20