• 100% Satisfaction Guarantee

.Paul, Computer Software Engineer
Category: Programming
Satisfied Customers: 44
Experience:  15 years visual basic experience
13558067
.Paul is online now

# Design a While loop that lets the user enter a number.

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.
try this:

declare integer product
declare integer number

product = 0

do while product < 100
display "Enter a number"
input number
product = product + number * 10
loop

display product
was that how you expected it?

could you post the question as it is in the book? i've had this question before + i thought it was slightly different...
Customer: replied 7 years ago.
that looks right but how does the program end. I also have about 9 more questions can you help
when you enter a number it multiplies it by 10 + adds it to product. thats the part i'm not sure of. should product just contain the number * 10 or the running total?

when product is greater than 99 the program exits the loop, and the program ends.

yes i can help with your other questions. usually you'd put them in a new question, with a reasonable value (mark it "for .Paul" in the subject), or i can answer them in this thread for a bonus.
Customer: replied 7 years ago.

the book question is as stated exactly how written in the first question.

how much is the bonus total cost for all 10 questions.

this is the answer to the first question then:

declare integer product
declare integer number

product = 0

do while product < 100
display "Enter a number"
input number
product = number * 10
loop

.Paul, Computer Software Engineer
Category: Programming
Satisfied Customers: 44
Experience: 15 years visual basic experience

You can post your questions + i'll get started on them.

Customer: replied 7 years ago.

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

1/30 + 2/29 + 3/28 + ... 30/1

declare decimal result

result = 0

for x = 1 to 30
result = result + x / (31 - x)
next

display result
Customer: replied 7 years ago.

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

Declare Integer x = 1

While x > 0

Display "Enter a number"

Input x

End While

Declare Integer x = 1

do While x > 0

Display "Enter a number"

Input x

loop
Customer: replied 7 years ago.

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 is

9

F= --- C+32

5

Where F is the Fahrenheit temperature and C is the Centigrade temperature. Your program must use a loop to display the table.

declare string msg

msg = ""

For C = 0 To 20
msg = msg & C & "C" & vbTab & (C * (9 / 5) + 32) & "F" & vbnewline
Next

display msg
Customer: replied 7 years ago.

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 a series. After all the numbers have been entered, the program should display the largest and smallest numbers entered.

declare integer largest
declare integer smallest
declare integer number

largest = Integer.MinValue
smallest = Integer.MaxValue
number = 0

do while number <> -99
display "Enter a number"
input number
If number <> -99 And number > largest Then largest = number
If number <> -99 And number < smallest Then smallest = number
loop

display "smallest = " & smallest
display "largest = " & largest
Customer: replied 7 years ago.
write a pseudocode statement that generates a random number in the range of 1 through 100 and assigns it to a value named rand.
Dim rand As Integer
rand = 100 * Rnd() + 1
Customer: replied 7 years ago.

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

Function timesTen(number As Integer) As Integer
Return number * 10
End Function
Customer: replied 7 years ago.

Design a function named getFirstName that ask the user to enter his or her first name, and returns it.

Function getFirstName() as String
declare string name
Input name
Return name
End Function
Customer: replied 7 years ago.

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/2mv^2

The variables in the formula are as follows: KE is the kinetic energy, m is the objects 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 meter per second) as arguments. The function should return the amount of kinetic energy that the object has. Design a program that ask the user to enter values for mass and velocity, and then calls the kineticEnergy function to get the object's kinetic energy.

Declare integer mass
Declare integer velocity

display "Enter mass."
Input mass
display "Enter velocity."
Input velocity

Display KineticEnergy(mass,velocity)

Function KineticEnergy(m As Integer, v As Integer)
Return 1 / 2 * m * v ^ 2
End Function
Customer: replied 7 years ago.

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 ***** then the computer has chosen rock. If the number is ***** then the computer has chosen paper. If the number is ***** then the computer has chosen scissors. (Don't display the computer's choice yet.)

(2) The user enters 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 or 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, the 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 winner.
Declare integer rand
rand = 3 * Rnd() + 1
Declare integer choice
Display "Enter your choice. (Rock = 1, Paper = 2, Scissors = 3)"
Input choice
Declare string pcChoice
Select Case rand
Case 1
pcChoice = "Rock"
Case 2
pcChoice = "Paper"
Case 3
pcChoice = "Scissors"
End Select

Display "Computer chose: " & pcChoice

If rand = choice Then
Display "No winner."
End If

If rand = 1 And choice = 3 Then 'rock,scissors
Display "Computer won."
ElseIf rand = 3 And choice = 1 Then 'scissors,rock
Display "You won."
End If

If rand = 3 And choice = 2 Then 'scissors,paper
Display "Computer won."
ElseIf rand = 2 And choice = 3 Then 'paper,scissors
Display "You won."
End If

If rand = 2 And choice = 1 Then 'paper,rock
Display "Computer won."
ElseIf rand = 1 And choice = 2 Then 'rock,paper
Display "You won."
End If
.Paul, Computer Software Engineer
Category: Programming
Satisfied Customers: 44
Experience: 15 years visual basic experience
Customer: replied 7 years ago.
yes how can I get you the next time I have questions

In the subject line of your question type "for .Paul"

thanks again

Ask-a-doc Web sites: If you've got a quick question, you can try to get an answer from sites that say they have various specialists on hand to give quick answers... Justanswer.com.
...leave nothing to chance.
Traffic on JustAnswer rose 14 percent...and had nearly 400,000 page views in 30 days...inquiries related to stress, high blood pressure, drinking and heart pain jumped 33 percent.
Tory Johnson, GMA Workplace Contributor, discusses work-from-home jobs, such as JustAnswer in which verified Experts answer people’s questions.
I will tell you that...the things you have to go through to be an Expert are quite rigorous.

### What Customers are Saying:

• My Expert answered my question promptly and he resolved the issue totally. This is a great service. I am so glad I found it I will definitely use the service again if needed. One Happy Customer New York
< Previous | Next >
• My Expert answered my question promptly and he resolved the issue totally. This is a great service. I am so glad I found it I will definitely use the service again if needed. One Happy Customer New York
• Wonderful service, prompt, efficient, and accurate. Couldn't have asked for more. I cannot thank you enough for your help. Mary C. Freshfield, Liverpool, UK
• This expert is wonderful. They truly know what they are talking about, and they actually care about you. They really helped put my nerves at ease. Thank you so much!!!! Alex Los Angeles, CA
• Thank you for all your help. It is nice to know that this service is here for people like myself, who need answers fast and are not sure who to consult. GP Hesperia, CA
• I couldn't be more satisfied! This is the site I will always come to when I need a second opinion. Justin Kernersville, NC
• Just let me say that this encounter has been entirely professional and most helpful. I liked that I could ask additional questions and get answered in a very short turn around. Esther Woodstock, NY
• Thank you so much for taking your time and knowledge to support my concerns. Not only did you answer my questions, you even took it a step further with replying with more pertinent information I needed to know. Robin Elkton, Maryland

• ### ATLPROG

#### Satisfied Customers:

7671
MS in IT.Several years of programming experience in Java C++ C C# Python VB Javascript HTML
< Last | Next >

### ATLPROG

#### Satisfied Customers:

7671
MS in IT.Several years of programming experience in Java C++ C C# Python VB Javascript HTML

### LogicPro

#### Satisfied Customers:

6535
Expert in C, C++, Java, DOT NET, Python, HTML, Javascript, Design.

#### Satisfied Customers:

1168
Good knowledge of OOP principles. 3+ years of programming experience with Java and C++. Sun Certified Java Programmer 5.0.

### lifesaver

#### Satisfied Customers:

950
Several years of intensive programming and application development experience in various platforms.

### ehabtutor

#### Satisfied Customers:

931
Bachelor of computer science, 5+ years experience in software development, software company owner

### TheDoctor

#### Satisfied Customers:

893
M.S. in Internet Information Systems

### The-PC-Guy

#### Satisfied Customers:

682
Extensive Knowledge in PHP, MYSQL, CSS & Javascript