question archive Write a program that moves a forester unit and a desert corps unit to a given target location and prints the number of hours it took for each unit to reach the target First, the user will give the starting X and Y positions of the forester unit as well as its base speed (all ints)

Write a program that moves a forester unit and a desert corps unit to a given target location and prints the number of hours it took for each unit to reach the target First, the user will give the starting X and Y positions of the forester unit as well as its base speed (all ints)

Subject:Computer SciencePrice: Bought3

Write a program that moves a forester unit and a desert corps unit to a given target location and prints the number of hours it took for each unit to reach the target First, the user will give the starting X and Y positions of the forester unit as well as its base speed (all ints). Then, the starting X and Y positions of the desert corps unit as well as its base speed (all ints) Finally, the target X and Y positions (both ints) and the terrain type (std::string) Speeds are given as distance traveled in one full day lie, 24 hours) and is affected by the terrain type using a multiplier over the base speed. Also, after 1 full day, each unit rests for a certain number of hours. Speed multiplier and rest amount of each type of unit depending on the terrain type are as below. Speed Multiplier Rest Duration After 1 day Terrain type Forester Desert Corps Forester Desert Corps Forest 1.3 4 12 Desert 1.2 15 6 Hills 0.7 0.8 6 8 Others 1.0 0.8 8 6 . . After getting all this information, the program will move both the units to the target by printing out the total time in hours) it took the units to reach their target and their final positions in the format seen in the outputs Requirements You should define a class for the unit, two CHILD classes of the unit class one for the forester unit, another for the desert corps unit. Coordinate information should be kept as private inside the unit class whereas the speed information should be kept as protected inside the unit class. Classes should take the related input in their constructor functions. The base unit class MUST have a public function which prints out the current location of the unit. The base unit class MUST have a protected function which moves the unit to a given location The base unit class MUST have a protected function which calculates the distance between itself and a target location Each child classes MUST have a public function which moves the unit to a target location given the terrain type calculates the total amount of hours it took the unit to reach to the target and print it out. Getting all the user input, instantiating objects, calling the move functions of the child classes should be done in the main) function. Do NOT use polymorphism in this question ... do NOT overload the move function of the base class) . . . bo 20 b025 10 70 44 60 432 10 70 44 60 432 nput 0 100 forest Forester walked for 1104.308 hours Desert Corps walked for 232 hours 80 24 desert 80 24 hills Forester walked for Forester walked for 174.22 hours 67.2688 hours Desert Corps walked Desert Corps walked For 17.6777 hours For 34.5165 hours Unit is at 80.24 Unit is at 80.24 Unit is at 80.24 Unit is at 80.24 Output Unit is at 0.100 Unit is at 0.100

pur-new-sol

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE