Assignment 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 (i.e., 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 0.6 4 12 Desert 0.4 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

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Assignment 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 (i.e., 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 0.6 4 12 Desert 0.4 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 (i.e., do NOT overload the move function of the base class). 0 0 20 10 70 44 10 70 44 Input 0 0 25 60 432 60 432 0 100 forest 80 24 desert 80 24 hills Forester walked for Forester walked for Forester walked for 104.308 hours 174.22 hours 77.2688 hours Desert Corps walked Desert Corps walked Desert Corps walked for 232 hours for 17.6777 hours for 34.5165 hours Unit is at 0, 100 Unit is at 80, 24 Unit is at 80, 24 Unit is at 0, 100 Unit is at 80, 24 Unit is at 80, 24 Output

Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Mathematical functions
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education