Design a While loop that lets the user enter a number. The number should be multiplied by 10, and the result stored in a variable named product. The loop should iterate as long as product contains a...



  1. Design a While loop that lets the user enter a number. The number should be multiplied by 10, and the result stored in a variable named product. The loop should iterate as long as product contains a value less than 100.



  1. Design a For loop that calculates the total of the following series of numbers:


1 + 2 + 3 + …..3030 29 28 1

  1. Convert the While loop in the following code to a Do-While loop:


Declare Integer x = 1While x > 0Display “Enter a number.”Input xEnd While


  1. Centigrade to Fahrenheit Table


Design a program that displays a table of the centigrade temperatures 0 through 20 and their Fahrenheit equivalents. The formula for converting a temperature from centigrade to Fahrenheit isF=9 C + 325


  1. Largest and Smallest


Design a program with a loop that lets the user enter a series of numbers. The user should enter-99 to signal the end of the series. After all the numbers have been entered, the program should display the largest and smallest numbers entered.

  1. Write a pseudocode statement that generates a random number in the range of 1 through 100 and assigns it to a variable named rand.



  1. Design a function named timesTen that accepts and Integer argument. When the function is called, it should return the value of its argument multiplied times 10.




  1. Kinetic Energy


In physics, an object that is in motion is said to have kinetic energy. The following formula can be used to determine a moving object’s kinetic energy:KE = 1/2mv2The variables in the formula are as follows: KE is the kinetic energy, m is the object’s mass in kilograms, and v is the object’s velocity, in meters per second.Design a function named kineticEnergy that accepts an object’s mass (in kilograms) and velocity (in meters per second) as arguments. The function should return the amount of kinetic energy that the object has. Design a program that asks the user to enter values for mass and velocity, and then calls the kineticEnergy function to get the object’s kinetic energy.


  1. Rock, Paper, Scissors Game


Design a program that lets the user play the game of Rock, Paper, Scissors against the computer. The program should work as follows.

  1. When the program begins, a random number in the range of 1 through 3 is generated. If the number is 1, then the computer has chosen rock. If the number is 2, then the computer has chosen paper. If the number is 3, then the computer has chosen scissors. (Don’t display the computer’s choice yet).

  2. The user enter his or her choice of “rock,” “paper”, or “scissors” at the keyboard.

  3. The computer’s choice is displayed.

  4. The program should display a message indicating whether the user of the computer was the winner. A winner is selected according to the following rules:



  • If one player chooses rock and the other player chooses scissors, then rock wins. (The rock smashes the scissors)

  • If one player chooses scissors and the other player chooses paper, then scissors wins. (Scissors cuts paper)

  • If one player chooses paper and the other player chooses rock, then paper wins. (Paper wraps rock)

  • If both players make the same choice, the game must be played again to determine the wintner

Nov 11, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here