Coding Practice

Write a simple function called greetUser which prompts the user for their full name. Then the function outputs “Hello fullName!”. Select the Parsonsprob tab for hints for the construction of the code.

Write a simple function called greetUser which prompts the user for their full name. Then the function outputs “Hello fullName!”. Use the lines to construct the code, then go back to complete the Activecode tab.

Robots will naturally deplete their charge as they carry out tasks. Write a function called chargeRobot which takes a Robot as a parameter and charges the robot to 100 percent. Then output the statement “Robot name is fully charged!”. Select the Parsonsprob tab for hints for the construction of the code.

Robots will naturally deplete their charge as they carry out tasks. Write a function called chargeRobot which takes a Robot as a parameter and charges the robot to 100 percent. Then output the statement “Robot name is fully charged!”. Use the lines to construct the code, then go back to complete the Activecode tab.

Write the Pokemon structure, which has instance variables string pokeName, string type, int level, and int healthPercentage in that order. Next, write the function printPokeInfo, which takes a Pokemon as a parameter and outputs the Pokemon’s info in the following format: pokeName (Lv. level, healthPercentage% HP). Select the Parsonsprob tab for hints for the construction of the code.

Write the Pokemon structure, which has instance variables string pokeName, string type, int level, and int healthPercentage in that order. Next, write the function printPokeInfo, which takes a Pokemon as a parameter and outputs the Pokemon’s info in the following format: pokeName (Lv. level, healthPercentage% HP). Use the lines to construct the code, then go back to complete the Activecode tab.

When Pokemon are injured, they can be healed up at the Pokemon Center. Write the function healPokemon, which takes a Trainer as a parameter and heals the Trainer’s Pokemon to 100 percent health. Select the Parsonsprob tab for hints for the construction of the code.

When Pokemon are injured, they can be healed up at the Pokemon Center. Write the function healPokemon, which takes a Trainer as a parameter and heals the Trainer’s Pokemon to 100 percent health. Use the lines to construct the code, then go back to complete the Activecode tab.

Ever wanted to know how much you’d weigh on each planet? Write the convertWeight function, which takes a double earthWeight and int planet as parameters. First, in main, prompt the user to enter their weight in pounds and a number corresponding to a planet (Mercury is 1, Venus is 2, etc.). Next, call the convertWeight function using the user’s input. Finally, print out their weight on that planet. If the user inputs an invalid planet, print out an error message. The weight conversion are as follows (multiply the number by earthWeight to get the weight on that planet): Mercury - 0.38, Venus - 0.91, Earth - 1.00, Mars - 0.38, Jupiter - 2.34, Saturn - 1.06, Uranus - 0.92, and Neptune - 1.19. Select the Parsonsprob tab for hints for the construction of the code. Below are some examples.

Please enter your weight in pounds: 145.6
Please select a planet: 3
Your weight on Earth is 145.6 pounds.

or

Please enter your weight in pounds: 170
Please select a planet: 1
Your weight on Mercury is 64.6 pounds.

or

Please enter your weight in pounds: 170
Please select a planet: 23
Error, not a valid planet.

Ever wanted to know how much you’d weigh on each planet? Write the convertWeight function, which takes a double earthWeight and int planet as parameters. First, in main, prompt the user to enter their weight in pounds and a number corresponding to a planet (Mercury is 1, Venus is 2, etc.). Next, call the convertWeight function using the user’s input. Finally, print out their weight on that planet. If the user inputs an invalid planet, print out an error message. The weight conversion are as follows (multiply the number by earthWeight to get the weight on that planet): Mercury - 0.38, Venus - 0.91, Earth - 1.00, Mars - 0.38, Jupiter - 2.34, Saturn - 1.06, Uranus - 0.92, and Neptune - 1.19. Use the lines to construct the code, then go back to complete the Activecode tab. Below are some examples.

Please enter your weight in pounds: 145.6
Please select a planet: 3
Your weight on Earth is 145.6 pounds.

or

Please enter your weight in pounds: 170
Please select a planet: 1
Your weight on Mercury is 64.6 pounds.

or

Please enter your weight in pounds: 170
Please select a planet: 23
Error, not a valid planet.
You have attempted of activities on this page