How JustAnswer Works:

  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.

Ask .Paul Your Own Question

.Paul
.Paul, Computer Software Engineer
Category: Programming
Satisfied Customers: 44
Experience:  15 years visual basic experience
13558067
Type Your Programming Question Here...
.Paul is online now
A new question is answered every 9 seconds

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

Resolved Question:

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.
Submitted: 5 years ago.
Category: Programming
Expert:  .Paul replied 5 years ago.
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
Expert:  .Paul replied 5 years ago.
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 5 years ago.
that looks right but how does the program end. I also have about 9 more questions can you help
Expert:  .Paul replied 5 years ago.
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 5 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.

Expert:  .Paul replied 5 years ago.

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
.Paul and 5 other Programming Specialists are ready to help you
Expert:  .Paul replied 5 years ago.

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

Customer: replied 5 years ago.

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

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

Expert:  .Paul replied 5 years ago.
declare decimal result

result = 0

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

display result
Customer: replied 5 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

Expert:  .Paul replied 5 years ago.
Declare Integer x = 1

do While x > 0

Display "Enter a number"

Input x

loop
Customer: replied 5 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.

Expert:  .Paul replied 5 years ago.
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 5 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.

Expert:  .Paul replied 5 years ago.
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 5 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.
Expert:  .Paul replied 5 years ago.
Dim rand As Integer
rand = 100 * Rnd() + 1
Customer: replied 5 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.

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

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

Expert:  .Paul replied 5 years ago.
Function getFirstName() as String
    declare string name
    display "Enter your first name."
    Input name
    Return name
End Function
Customer: replied 5 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.

Expert:  .Paul replied 5 years ago.
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 5 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.
Expert:  .Paul replied 5 years ago.
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
.Paul and 5 other Programming Specialists are ready to help you
Customer: replied 5 years ago.
yes how can I get you the next time I have questions
Expert:  .Paul replied 5 years ago.

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

thanks again

JustAnswer in the News:

 
 
 
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.
JustAnswer.com...has seen a spike since October in legal questions from readers about layoffs, unemployment and severance.
Web sites like justanswer.com/legal
...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
< Last | 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
 
 
 

Meet The Experts:

 
 
 
  • ATLPROG

    Computer Software Engineer

    Satisfied Customers:

    7463
    MS in IT.Several years of programming experience in Java C++ C C# Python VB Javascript HTML
< Last | Next >
  • http://ww2.justanswer.com/uploads/SP/spatlanta2010/2011-6-23_12450_photo.64x64.gif ATLPROG's Avatar

    ATLPROG

    Computer Software Engineer

    Satisfied Customers:

    7463
    MS in IT.Several years of programming experience in Java C++ C C# Python VB Javascript HTML
  • http://ww2.justanswer.com/uploads/ComputersGuru/2010-02-13_051118_Photo41.JPG LogicPro's Avatar

    LogicPro

    Computer Software Engineer

    Satisfied Customers:

    5603
    Expert in C, C++, Java, DOT NET, Python, HTML, Javascript, Design.
  • http://ww2.justanswer.com/uploads/unvadim/2010-11-15_210218_avatar.jpg unvadim's Avatar

    unvadim

    Computer Software Engineer

    Satisfied Customers:

    1158
    Good knowledge of OOP principles. 3+ years of programming experience with Java and C++. Sun Certified Java Programmer 5.0.
  • http://ww2.justanswer.com/uploads/lifesaver333/2010-10-17_191349_ls.jpeg lifesaver's Avatar

    lifesaver

    Computer Software Engineer

    Satisfied Customers:

    950
    Several years of intensive programming and application development experience in various platforms.
  • http://ww2.justanswer.com/uploads/EH/ehabtutor/2012-8-2_202016_1.64x64.jpg ehabtutor's Avatar

    ehabtutor

    Computer Software Engineer

    Satisfied Customers:

    864
    Bachelor of computer science, 5+ years experience in software development, software company owner
  • http://ww2.justanswer.com/uploads/RA/rajivsharma086/2012-6-6_17128_displaypic.64x64.jpg Raj's Avatar

    Raj

    Computer Engg.

    Satisfied Customers:

    860
    BE CS, 4+ Experience in Programming and Database (ERP)
  • http://ww2.justanswer.com/uploads/eljonis/2010-01-06_130406_eljon2.jpg Eljon's Avatar

    Eljon

    Consultant

    Satisfied Customers:

    590
    11 yrs of programming (PHP, WordPress, XSL, SQL, JavaScript)
 
 
 

Related Programming Questions

Chat Now With A Programmer
.Paul
.Paul
43 Satisfied Customers
15 years visual basic experience