D020 0 70 44 2025 3012 60432 8O 24 r 3024 sairi lked la ked for 9.1ADS E 192.143hourN 0100

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
P020
0432
24 aia
Hurester nakede
er lo
Input:
0020
10 70 44
0 025
60 432
0 100 forest
80 24 marsh
Output: Forester walked for 103.889 hours
Forester walked for 121,376 hour
Mountaineer walked for 192.143 hours
Mountaineer walked for 59.1405 hours
Unit is at 0, 100
Unit is at 0, 100
Unit is at 80, 24
Unit is at 80, 24
Input: 10 7044
604 32
80 24 mountain
Output : Forester walked for 809175 hours
Mountaineer walked for 15.1523 hours
Unit is at 80, 24
Unit is at 80, 24
Transcribed Image Text:P020 0432 24 aia Hurester nakede er lo Input: 0020 10 70 44 0 025 60 432 0 100 forest 80 24 marsh Output: Forester walked for 103.889 hours Forester walked for 121,376 hour Mountaineer walked for 192.143 hours Mountaineer walked for 59.1405 hours Unit is at 0, 100 Unit is at 0, 100 Unit is at 80, 24 Unit is at 80, 24 Input: 10 7044 604 32 80 24 mountain Output : Forester walked for 809175 hours Mountaineer walked for 15.1523 hours Unit is at 80, 24 Unit is at 80, 24
In C+,Write a program that moves a forester unit and a mountaineer 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 asa its base speed (all
Ints) Then the starting X and Y positions of the mountaineer unit as well as its base speed (all ints).
Finally, the target X and Y positions (both ints) and the terrain type (std::string).
Speed 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 Matiplier
Reu Duration Alier 1day
Forester
Mouraineer
Forester
Mounmaineer
Forest
135
Moursain
14
Mansh
0.5
10
12
Qihers
0.85
011
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 int he format seen in
the outputs.
Requirements:
You should deline a class fort he unit, two CHILD classes of the unit class one for the forester unit, another
fort he mountaineer unit.
Coordinate information should be kept as private inside the unit class whereas the speed information
shouldbe kept as protected inside the unit class.
Classes should take the related input in their constructor functions
Lhe 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 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
Eype, 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 pollymorphisim in this question(i.e., do NOT overload the move functionof the base dass).
Transcribed Image Text:In C+,Write a program that moves a forester unit and a mountaineer 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 asa its base speed (all Ints) Then the starting X and Y positions of the mountaineer unit as well as its base speed (all ints). Finally, the target X and Y positions (both ints) and the terrain type (std::string). Speed 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 Matiplier Reu Duration Alier 1day Forester Mouraineer Forester Mounmaineer Forest 135 Moursain 14 Mansh 0.5 10 12 Qihers 0.85 011 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 int he format seen in the outputs. Requirements: You should deline a class fort he unit, two CHILD classes of the unit class one for the forester unit, another fort he mountaineer unit. Coordinate information should be kept as private inside the unit class whereas the speed information shouldbe kept as protected inside the unit class. Classes should take the related input in their constructor functions Lhe 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 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 Eype, 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 pollymorphisim in this question(i.e., do NOT overload the move functionof the base dass).
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Knowledge Booster
Concept of Light
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.
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