SlideShare a Scribd company logo
1 of 1
Download to read offline
To practice recursion with a simple example.
Degree of Difficulty: Easy.
With the recent interest in space travel, Elon a famous rocket scientist, has invented a new
spaceship
that can travel very quickly. The following describes the motion of the rocket:
If the distance to a destination is greater than 1 meter, the rocket goes into hyperdrive and
moves half-
way to the destination in 1 minute. The rockets computer determines the speed it needs to travel
for that
distance.
If the distance to the destination is 1 meter or less, it uses its normal rockets and that takes one
minute.
For example, if the ship has to travel 10 meters, it will travel 5 meters in the first minute, 2.5
meters the
second minute, 1.25 meters the 3rd minute, and 0.625 meters the fourth minute. Finally, the
remaining
0.625 meters takes one more minute. Thus, the total time to travel 10 meters is 5 minutes. While
this
seems slow for this short distance, its performance over long distances is outstanding.
Write a recursive function called TravelTime() that calculates the time needed for the rocket to
travel a
given distance.
Then write a main program to test your function on all the following examples. Rather than
asking for console input,
use one or more compound data structures (e.g., lists) to store a) the travel distances and b) the
corresponding
message(s) for each travel distance.
Distance between spaceship base and nearest coffee shop: 537 meters.
Distance between spaceship base and its nearest moon: 3.84e8 meters (about 400 thousand km).
Average distance between earth and our sun: 1.49e11 meters (about 150 million km).
Approximate distance between sun and its closest star: 4.0e16 meters (about 4 light-years).
Size of the observable universe: 8.8e26 meters (about 93 Giga-light-years)

More Related Content

Similar to To practice recursion with a simple example. Degree of Difficulty.pdf

Uranus is perpendicular on earth moon orbit (viii)
Uranus is perpendicular on earth moon orbit (viii)Uranus is perpendicular on earth moon orbit (viii)
Uranus is perpendicular on earth moon orbit (viii)Gerges francis
 
Exams on science,
Exams on science, Exams on science,
Exams on science, jaume2014
 
satellite communication system
satellite communication systemsatellite communication system
satellite communication systemAmjad Khan
 
Uranus is perpendicular on earth moon orbit (viii) (revised)
Uranus is perpendicular on earth moon orbit (viii) (revised)Uranus is perpendicular on earth moon orbit (viii) (revised)
Uranus is perpendicular on earth moon orbit (viii) (revised)Gerges francis
 
MATH 6 PPT Q3 - Calculate The Speed, Area, And Surface Area Of Plane And Soli...
MATH 6 PPT Q3 - Calculate The Speed, Area, And Surface Area Of Plane And Soli...MATH 6 PPT Q3 - Calculate The Speed, Area, And Surface Area Of Plane And Soli...
MATH 6 PPT Q3 - Calculate The Speed, Area, And Surface Area Of Plane And Soli...LuisSalenga1
 
The Solar System Distances Network Theory (Revised)
The Solar System Distances Network Theory (Revised) The Solar System Distances Network Theory (Revised)
The Solar System Distances Network Theory (Revised) Gerges francis
 
Theoretical background of satellite navigation systems functioning (Lecture 4)
Theoretical background of satellite navigation systems functioning (Lecture 4)Theoretical background of satellite navigation systems functioning (Lecture 4)
Theoretical background of satellite navigation systems functioning (Lecture 4)Olexiy Pogurelskiy
 
Mars Lesson Presentation
Mars Lesson PresentationMars Lesson Presentation
Mars Lesson PresentationErin Lewis
 
Why The Moon Apogee Circumference =2.55 mkm?
Why The Moon Apogee Circumference =2.55 mkm? Why The Moon Apogee Circumference =2.55 mkm?
Why The Moon Apogee Circumference =2.55 mkm? Gerges francis
 
1d motion worksheet_packet
1d motion worksheet_packet1d motion worksheet_packet
1d motion worksheet_packetaltwirqi
 
SCIECE FOR GRADE 5 FINDING SPEED DISTANCE AND TIME
SCIECE FOR GRADE 5 FINDING SPEED DISTANCE AND TIMESCIECE FOR GRADE 5 FINDING SPEED DISTANCE AND TIME
SCIECE FOR GRADE 5 FINDING SPEED DISTANCE AND TIMEgladysmaaarquezramos
 
Planet Motion Analytical Description (Revised).pdf
Planet Motion Analytical Description (Revised).pdfPlanet Motion Analytical Description (Revised).pdf
Planet Motion Analytical Description (Revised).pdfGerges francis
 
My research basic arguments (iv)
My research basic arguments (iv)My research basic arguments (iv)
My research basic arguments (iv)Gerges francis
 
Why Saturn orbital distance = Saturn Uranus distance (ii)
Why Saturn orbital distance = Saturn Uranus distance (ii)Why Saturn orbital distance = Saturn Uranus distance (ii)
Why Saturn orbital distance = Saturn Uranus distance (ii)Gerges francis
 
satellite communication (1).pdf
satellite communication (1).pdfsatellite communication (1).pdf
satellite communication (1).pdfbalaponnusamy3
 
Orbit design for exoplanet discovery spacecraft dr dora musielak 1 april 2019
Orbit design for exoplanet discovery spacecraft dr dora musielak 1 april 2019Orbit design for exoplanet discovery spacecraft dr dora musielak 1 april 2019
Orbit design for exoplanet discovery spacecraft dr dora musielak 1 april 2019Dora Musielak, Ph.D.
 
THE HUMAN CHALLENGES OF CONQUERING SPACE AND COLONIZING OTHER WORLDS.pdf
THE HUMAN CHALLENGES OF CONQUERING SPACE AND COLONIZING OTHER WORLDS.pdfTHE HUMAN CHALLENGES OF CONQUERING SPACE AND COLONIZING OTHER WORLDS.pdf
THE HUMAN CHALLENGES OF CONQUERING SPACE AND COLONIZING OTHER WORLDS.pdfFaga1939
 
Does Planet Day Period Depend On Its Circumference(V)
Does Planet Day Period Depend On Its Circumference(V)Does Planet Day Period Depend On Its Circumference(V)
Does Planet Day Period Depend On Its Circumference(V)Gerges francis
 

Similar to To practice recursion with a simple example. Degree of Difficulty.pdf (20)

Uranus is perpendicular on earth moon orbit (viii)
Uranus is perpendicular on earth moon orbit (viii)Uranus is perpendicular on earth moon orbit (viii)
Uranus is perpendicular on earth moon orbit (viii)
 
Exams on science,
Exams on science, Exams on science,
Exams on science,
 
satellite communication system
satellite communication systemsatellite communication system
satellite communication system
 
Sheet # 1
Sheet # 1Sheet # 1
Sheet # 1
 
Uranus is perpendicular on earth moon orbit (viii) (revised)
Uranus is perpendicular on earth moon orbit (viii) (revised)Uranus is perpendicular on earth moon orbit (viii) (revised)
Uranus is perpendicular on earth moon orbit (viii) (revised)
 
MATH 6 PPT Q3 - Calculate The Speed, Area, And Surface Area Of Plane And Soli...
MATH 6 PPT Q3 - Calculate The Speed, Area, And Surface Area Of Plane And Soli...MATH 6 PPT Q3 - Calculate The Speed, Area, And Surface Area Of Plane And Soli...
MATH 6 PPT Q3 - Calculate The Speed, Area, And Surface Area Of Plane And Soli...
 
The Solar System Distances Network Theory (Revised)
The Solar System Distances Network Theory (Revised) The Solar System Distances Network Theory (Revised)
The Solar System Distances Network Theory (Revised)
 
Theoretical background of satellite navigation systems functioning (Lecture 4)
Theoretical background of satellite navigation systems functioning (Lecture 4)Theoretical background of satellite navigation systems functioning (Lecture 4)
Theoretical background of satellite navigation systems functioning (Lecture 4)
 
Mars Lesson Presentation
Mars Lesson PresentationMars Lesson Presentation
Mars Lesson Presentation
 
Why The Moon Apogee Circumference =2.55 mkm?
Why The Moon Apogee Circumference =2.55 mkm? Why The Moon Apogee Circumference =2.55 mkm?
Why The Moon Apogee Circumference =2.55 mkm?
 
1d motion worksheet_packet
1d motion worksheet_packet1d motion worksheet_packet
1d motion worksheet_packet
 
SCIECE FOR GRADE 5 FINDING SPEED DISTANCE AND TIME
SCIECE FOR GRADE 5 FINDING SPEED DISTANCE AND TIMESCIECE FOR GRADE 5 FINDING SPEED DISTANCE AND TIME
SCIECE FOR GRADE 5 FINDING SPEED DISTANCE AND TIME
 
Planet Motion Analytical Description (Revised).pdf
Planet Motion Analytical Description (Revised).pdfPlanet Motion Analytical Description (Revised).pdf
Planet Motion Analytical Description (Revised).pdf
 
My research basic arguments (iv)
My research basic arguments (iv)My research basic arguments (iv)
My research basic arguments (iv)
 
Why Saturn orbital distance = Saturn Uranus distance (ii)
Why Saturn orbital distance = Saturn Uranus distance (ii)Why Saturn orbital distance = Saturn Uranus distance (ii)
Why Saturn orbital distance = Saturn Uranus distance (ii)
 
Motion
MotionMotion
Motion
 
satellite communication (1).pdf
satellite communication (1).pdfsatellite communication (1).pdf
satellite communication (1).pdf
 
Orbit design for exoplanet discovery spacecraft dr dora musielak 1 april 2019
Orbit design for exoplanet discovery spacecraft dr dora musielak 1 april 2019Orbit design for exoplanet discovery spacecraft dr dora musielak 1 april 2019
Orbit design for exoplanet discovery spacecraft dr dora musielak 1 april 2019
 
THE HUMAN CHALLENGES OF CONQUERING SPACE AND COLONIZING OTHER WORLDS.pdf
THE HUMAN CHALLENGES OF CONQUERING SPACE AND COLONIZING OTHER WORLDS.pdfTHE HUMAN CHALLENGES OF CONQUERING SPACE AND COLONIZING OTHER WORLDS.pdf
THE HUMAN CHALLENGES OF CONQUERING SPACE AND COLONIZING OTHER WORLDS.pdf
 
Does Planet Day Period Depend On Its Circumference(V)
Does Planet Day Period Depend On Its Circumference(V)Does Planet Day Period Depend On Its Circumference(V)
Does Planet Day Period Depend On Its Circumference(V)
 

More from aksbjj

use in python Description Problem Statement You are given a list o.pdf
use in python Description Problem Statement You are given a list o.pdfuse in python Description Problem Statement You are given a list o.pdf
use in python Description Problem Statement You are given a list o.pdfaksbjj
 
Use a nested loop in java that produces this output.pdf
Use a nested loop in java that produces this output.pdfUse a nested loop in java that produces this output.pdf
Use a nested loop in java that produces this output.pdfaksbjj
 
Urgent!! help please The operator which produces the following o.pdf
Urgent!! help please The operator which produces the following o.pdfUrgent!! help please The operator which produces the following o.pdf
Urgent!! help please The operator which produces the following o.pdfaksbjj
 
uppose we have a database for an university. The requirements are as.pdf
uppose we have a database for an university. The requirements are as.pdfuppose we have a database for an university. The requirements are as.pdf
uppose we have a database for an university. The requirements are as.pdfaksbjj
 
updated The following is a list of financial statement items and am.pdf
updated  The following is a list of financial statement items and am.pdfupdated  The following is a list of financial statement items and am.pdf
updated The following is a list of financial statement items and am.pdfaksbjj
 
Unit Managing a Successful Business ProjectBusiness Recovery-T.pdf
Unit  Managing a Successful Business ProjectBusiness Recovery-T.pdfUnit  Managing a Successful Business ProjectBusiness Recovery-T.pdf
Unit Managing a Successful Business ProjectBusiness Recovery-T.pdfaksbjj
 
Unit 1 research reportIn addition to climate change, polar bea.pdf
Unit 1 research reportIn addition to climate change, polar bea.pdfUnit 1 research reportIn addition to climate change, polar bea.pdf
Unit 1 research reportIn addition to climate change, polar bea.pdfaksbjj
 
Uniox, Inc. pretende incrementar sus beneficios en un 50 en el pr�x.pdf
Uniox, Inc. pretende incrementar sus beneficios en un 50 en el pr�x.pdfUniox, Inc. pretende incrementar sus beneficios en un 50 en el pr�x.pdf
Uniox, Inc. pretende incrementar sus beneficios en un 50 en el pr�x.pdfaksbjj
 
Un investigador prob� a 40 adultos. Cada adulto tuvo que calificar s.pdf
Un investigador prob� a 40 adultos. Cada adulto tuvo que calificar s.pdfUn investigador prob� a 40 adultos. Cada adulto tuvo que calificar s.pdf
Un investigador prob� a 40 adultos. Cada adulto tuvo que calificar s.pdfaksbjj
 
Unclear what this error means. Could someone explain what Im doing .pdf
Unclear what this error means. Could someone explain what Im doing .pdfUnclear what this error means. Could someone explain what Im doing .pdf
Unclear what this error means. Could someone explain what Im doing .pdfaksbjj
 
Une al fot�grafo de th3 con una descripci�n de su trabajo Dorotea .pdf
Une al fot�grafo de th3 con una descripci�n de su trabajo Dorotea .pdfUne al fot�grafo de th3 con una descripci�n de su trabajo Dorotea .pdf
Une al fot�grafo de th3 con una descripci�n de su trabajo Dorotea .pdfaksbjj
 
Una organizaci�n de conversaci�n lo ha contratado para liderar los e.pdf
Una organizaci�n de conversaci�n lo ha contratado para liderar los e.pdfUna organizaci�n de conversaci�n lo ha contratado para liderar los e.pdf
Una organizaci�n de conversaci�n lo ha contratado para liderar los e.pdfaksbjj
 
Una persona con reputaci�n de involucrarse en la comunidad se niega .pdf
Una persona con reputaci�n de involucrarse en la comunidad se niega .pdfUna persona con reputaci�n de involucrarse en la comunidad se niega .pdf
Una persona con reputaci�n de involucrarse en la comunidad se niega .pdfaksbjj
 
Una empresa tiene una raz�n de deuda a activos de 0.45 y una raz�n d.pdf
Una empresa tiene una raz�n de deuda a activos de 0.45 y una raz�n d.pdfUna empresa tiene una raz�n de deuda a activos de 0.45 y una raz�n d.pdf
Una empresa tiene una raz�n de deuda a activos de 0.45 y una raz�n d.pdfaksbjj
 
Una evaluaci�n lineal del evento que ocurri�, donde el personal invo.pdf
Una evaluaci�n lineal del evento que ocurri�, donde el personal invo.pdfUna evaluaci�n lineal del evento que ocurri�, donde el personal invo.pdf
Una evaluaci�n lineal del evento que ocurri�, donde el personal invo.pdfaksbjj
 
Una enfermera est� recopilando datos sobre un reci�n nacido y sospec.pdf
Una enfermera est� recopilando datos sobre un reci�n nacido y sospec.pdfUna enfermera est� recopilando datos sobre un reci�n nacido y sospec.pdf
Una enfermera est� recopilando datos sobre un reci�n nacido y sospec.pdfaksbjj
 
T�rkiyede havaliman iletmelerinin kullandklar finansman kaynaklarn .pdf
T�rkiyede havaliman iletmelerinin kullandklar finansman kaynaklarn .pdfT�rkiyede havaliman iletmelerinin kullandklar finansman kaynaklarn .pdf
T�rkiyede havaliman iletmelerinin kullandklar finansman kaynaklarn .pdfaksbjj
 
TRUE OR FALSE1. Examples of dischargeable debts in bankruptcy incl.pdf
TRUE OR FALSE1. Examples of dischargeable debts in bankruptcy incl.pdfTRUE OR FALSE1. Examples of dischargeable debts in bankruptcy incl.pdf
TRUE OR FALSE1. Examples of dischargeable debts in bankruptcy incl.pdfaksbjj
 
TRUE OR FALSE1. If a creditor fails to perfect its security intere.pdf
TRUE OR FALSE1. If a creditor fails to perfect its security intere.pdfTRUE OR FALSE1. If a creditor fails to perfect its security intere.pdf
TRUE OR FALSE1. If a creditor fails to perfect its security intere.pdfaksbjj
 
Translate the following pseudocode into assembly language, assuming .pdf
Translate the following pseudocode into assembly language, assuming .pdfTranslate the following pseudocode into assembly language, assuming .pdf
Translate the following pseudocode into assembly language, assuming .pdfaksbjj
 

More from aksbjj (20)

use in python Description Problem Statement You are given a list o.pdf
use in python Description Problem Statement You are given a list o.pdfuse in python Description Problem Statement You are given a list o.pdf
use in python Description Problem Statement You are given a list o.pdf
 
Use a nested loop in java that produces this output.pdf
Use a nested loop in java that produces this output.pdfUse a nested loop in java that produces this output.pdf
Use a nested loop in java that produces this output.pdf
 
Urgent!! help please The operator which produces the following o.pdf
Urgent!! help please The operator which produces the following o.pdfUrgent!! help please The operator which produces the following o.pdf
Urgent!! help please The operator which produces the following o.pdf
 
uppose we have a database for an university. The requirements are as.pdf
uppose we have a database for an university. The requirements are as.pdfuppose we have a database for an university. The requirements are as.pdf
uppose we have a database for an university. The requirements are as.pdf
 
updated The following is a list of financial statement items and am.pdf
updated  The following is a list of financial statement items and am.pdfupdated  The following is a list of financial statement items and am.pdf
updated The following is a list of financial statement items and am.pdf
 
Unit Managing a Successful Business ProjectBusiness Recovery-T.pdf
Unit  Managing a Successful Business ProjectBusiness Recovery-T.pdfUnit  Managing a Successful Business ProjectBusiness Recovery-T.pdf
Unit Managing a Successful Business ProjectBusiness Recovery-T.pdf
 
Unit 1 research reportIn addition to climate change, polar bea.pdf
Unit 1 research reportIn addition to climate change, polar bea.pdfUnit 1 research reportIn addition to climate change, polar bea.pdf
Unit 1 research reportIn addition to climate change, polar bea.pdf
 
Uniox, Inc. pretende incrementar sus beneficios en un 50 en el pr�x.pdf
Uniox, Inc. pretende incrementar sus beneficios en un 50 en el pr�x.pdfUniox, Inc. pretende incrementar sus beneficios en un 50 en el pr�x.pdf
Uniox, Inc. pretende incrementar sus beneficios en un 50 en el pr�x.pdf
 
Un investigador prob� a 40 adultos. Cada adulto tuvo que calificar s.pdf
Un investigador prob� a 40 adultos. Cada adulto tuvo que calificar s.pdfUn investigador prob� a 40 adultos. Cada adulto tuvo que calificar s.pdf
Un investigador prob� a 40 adultos. Cada adulto tuvo que calificar s.pdf
 
Unclear what this error means. Could someone explain what Im doing .pdf
Unclear what this error means. Could someone explain what Im doing .pdfUnclear what this error means. Could someone explain what Im doing .pdf
Unclear what this error means. Could someone explain what Im doing .pdf
 
Une al fot�grafo de th3 con una descripci�n de su trabajo Dorotea .pdf
Une al fot�grafo de th3 con una descripci�n de su trabajo Dorotea .pdfUne al fot�grafo de th3 con una descripci�n de su trabajo Dorotea .pdf
Une al fot�grafo de th3 con una descripci�n de su trabajo Dorotea .pdf
 
Una organizaci�n de conversaci�n lo ha contratado para liderar los e.pdf
Una organizaci�n de conversaci�n lo ha contratado para liderar los e.pdfUna organizaci�n de conversaci�n lo ha contratado para liderar los e.pdf
Una organizaci�n de conversaci�n lo ha contratado para liderar los e.pdf
 
Una persona con reputaci�n de involucrarse en la comunidad se niega .pdf
Una persona con reputaci�n de involucrarse en la comunidad se niega .pdfUna persona con reputaci�n de involucrarse en la comunidad se niega .pdf
Una persona con reputaci�n de involucrarse en la comunidad se niega .pdf
 
Una empresa tiene una raz�n de deuda a activos de 0.45 y una raz�n d.pdf
Una empresa tiene una raz�n de deuda a activos de 0.45 y una raz�n d.pdfUna empresa tiene una raz�n de deuda a activos de 0.45 y una raz�n d.pdf
Una empresa tiene una raz�n de deuda a activos de 0.45 y una raz�n d.pdf
 
Una evaluaci�n lineal del evento que ocurri�, donde el personal invo.pdf
Una evaluaci�n lineal del evento que ocurri�, donde el personal invo.pdfUna evaluaci�n lineal del evento que ocurri�, donde el personal invo.pdf
Una evaluaci�n lineal del evento que ocurri�, donde el personal invo.pdf
 
Una enfermera est� recopilando datos sobre un reci�n nacido y sospec.pdf
Una enfermera est� recopilando datos sobre un reci�n nacido y sospec.pdfUna enfermera est� recopilando datos sobre un reci�n nacido y sospec.pdf
Una enfermera est� recopilando datos sobre un reci�n nacido y sospec.pdf
 
T�rkiyede havaliman iletmelerinin kullandklar finansman kaynaklarn .pdf
T�rkiyede havaliman iletmelerinin kullandklar finansman kaynaklarn .pdfT�rkiyede havaliman iletmelerinin kullandklar finansman kaynaklarn .pdf
T�rkiyede havaliman iletmelerinin kullandklar finansman kaynaklarn .pdf
 
TRUE OR FALSE1. Examples of dischargeable debts in bankruptcy incl.pdf
TRUE OR FALSE1. Examples of dischargeable debts in bankruptcy incl.pdfTRUE OR FALSE1. Examples of dischargeable debts in bankruptcy incl.pdf
TRUE OR FALSE1. Examples of dischargeable debts in bankruptcy incl.pdf
 
TRUE OR FALSE1. If a creditor fails to perfect its security intere.pdf
TRUE OR FALSE1. If a creditor fails to perfect its security intere.pdfTRUE OR FALSE1. If a creditor fails to perfect its security intere.pdf
TRUE OR FALSE1. If a creditor fails to perfect its security intere.pdf
 
Translate the following pseudocode into assembly language, assuming .pdf
Translate the following pseudocode into assembly language, assuming .pdfTranslate the following pseudocode into assembly language, assuming .pdf
Translate the following pseudocode into assembly language, assuming .pdf
 

Recently uploaded

CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,Virag Sontakke
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentInMediaRes1
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupJonathanParaisoCruz
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 

Recently uploaded (20)

CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,भारत-रोम व्यापार.pptx, Indo-Roman Trade,
भारत-रोम व्यापार.pptx, Indo-Roman Trade,
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Meghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media ComponentMeghan Sutherland In Media Res Media Component
Meghan Sutherland In Media Res Media Component
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized Group
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 

To practice recursion with a simple example. Degree of Difficulty.pdf

  • 1. To practice recursion with a simple example. Degree of Difficulty: Easy. With the recent interest in space travel, Elon a famous rocket scientist, has invented a new spaceship that can travel very quickly. The following describes the motion of the rocket: If the distance to a destination is greater than 1 meter, the rocket goes into hyperdrive and moves half- way to the destination in 1 minute. The rockets computer determines the speed it needs to travel for that distance. If the distance to the destination is 1 meter or less, it uses its normal rockets and that takes one minute. For example, if the ship has to travel 10 meters, it will travel 5 meters in the first minute, 2.5 meters the second minute, 1.25 meters the 3rd minute, and 0.625 meters the fourth minute. Finally, the remaining 0.625 meters takes one more minute. Thus, the total time to travel 10 meters is 5 minutes. While this seems slow for this short distance, its performance over long distances is outstanding. Write a recursive function called TravelTime() that calculates the time needed for the rocket to travel a given distance. Then write a main program to test your function on all the following examples. Rather than asking for console input, use one or more compound data structures (e.g., lists) to store a) the travel distances and b) the corresponding message(s) for each travel distance. Distance between spaceship base and nearest coffee shop: 537 meters. Distance between spaceship base and its nearest moon: 3.84e8 meters (about 400 thousand km). Average distance between earth and our sun: 1.49e11 meters (about 150 million km). Approximate distance between sun and its closest star: 4.0e16 meters (about 4 light-years). Size of the observable universe: 8.8e26 meters (about 93 Giga-light-years)