Preview

PT1420 Assign7

Good Essays
Open Document
Open Document
685 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
PT1420 Assign7
Edward
Martin
PT 1420
Unit7 Assignment1: Homework
Short Answer
1. Why should you indent the statement in the body of a loop? By indenting the statements, you make them stand out from the surrounding code. This helps you to identify at a glance the statements that are conditionally executed by a loop.
2. Described the difference between pretest loop and posttest loops. A pretest loop tests its condition before each iteration. A posttest loop tests its condition after each iteration. A posttest loop will always execute at least once.
3. What is a condition-controlled loop? Because they are only executed when a condition is true
4. What is a count-controlled loop? It is a condition-controlled loop with predictable number of iterations. The loop starts at some number (usually the topmost number or zero), then counts down until it reaches the limit (usually zero or the topmost number), at which point it exist the loop. The other common type starts at zero or one, and increments until it reaches a destination number.
5. What three do count-controlled loops typically perform using the counter variables? Test, Initialize and Increment
Algorithm
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 products. The loop should iterate as long as product contains a value less than 100. Dim product as integer While product < 100 Display “What is your number” Input number Product = number * 10 Display “Your number is”, product End While
2. Design a Do-While loop that asks the user to enter two numbers. The numbers should be added and the sum displayed. The loop should ask the user if he or she wishes to perform the operation again. If so, the loop should repeat, otherwise it should terminate. Declare 1num as Real Declare 2num as Real Declare SunNum as Real Do Display “What is your first number” Input 1num = “” Display “What is your second number” Input 2num SumNum =

You May Also Find These Documents Helpful

  • Satisfactory Essays

    PT1420 Chapter 3 Review

    • 1062 Words
    • 8 Pages

    6. Write a pseudocode statement that declares the variable total so it can hold integers. Initialize the variable with the value 0.…

    • 1062 Words
    • 8 Pages
    Satisfactory Essays
  • Powerful Essays

    POW 9 IMP3

    • 1192 Words
    • 5 Pages

    Create 2 formulas, one that will calculate the last number in terms of the first number and a constant increase in rate as well as the total amount of numbers. The second formula will add ass of the resulting numbers from the first formula together after the last number is calculated.…

    • 1192 Words
    • 5 Pages
    Powerful Essays
  • Satisfactory Essays

    Nt1330 Unit 2 Assignment 1

    • 3740 Words
    • 15 Pages

    1. A while loop will not execute the body of the code if you have your test condition incorrect.…

    • 3740 Words
    • 15 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Unit 7 Assignment 1

    • 261 Words
    • 2 Pages

    2. A pretest loop is a loop tests the conditions before performing the iteration. A posttest loop performs the iteration then test the condition.…

    • 261 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    Pt1420 Unit 4 Assignment

    • 377 Words
    • 2 Pages

    1. Name(s) of nation, major islands/island groups, capital - indigenous as well as colonial names.…

    • 377 Words
    • 2 Pages
    Good Essays
  • Satisfactory Essays

    Pt1420 Assignment

    • 1058 Words
    • 5 Pages

    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 the product contains a value less than 100.…

    • 1058 Words
    • 5 Pages
    Satisfactory Essays
  • Good Essays

    Pt1420 Unit 6 Assignment

    • 606 Words
    • 3 Pages

    When the activity was first assigned each member of the group was assigned a different part of the assignment. For, my part in the assignment I was assigned to complete the evaluation tool. The other three members were assigned one of the other three parts left in the activity. When, it came to deciding the activity we each came up with an idea, but then we eventually decided that we would do softball. After that, during the process there were group meetings held to figure the best way for the activity to be run, and how each member was doing with their part of the assignment. I was a little confused with the fact that I wasn’t assigned more work to do. In my opinion, I felt that I could’ve done more than just the evaluation tool I wanted to contribute more to the group. Beyond that, it confused me that during the activity, it took us a while to decide to let each batter have a runner with and…

    • 606 Words
    • 3 Pages
    Good Essays
  • Satisfactory Essays

    List three examples that show when a condition-controlled is better than count-controlled loop in programming?…

    • 351 Words
    • 2 Pages
    Satisfactory Essays
  • Powerful Essays

    Pt1420 Unit 2 Assignment

    • 1379 Words
    • 6 Pages

    Pro Bono Australia News (2013). Profile: cassandra goldie | pro bono australia. [online] Retrieved from: http://www.probonoaustralia.com.au/news/2010/09/profile-cassandra-goldie [Accessed: 12 Mar 2014].…

    • 1379 Words
    • 6 Pages
    Powerful Essays
  • Good Essays

    Pt1420 Unit 2 Assignment

    • 1381 Words
    • 6 Pages

    Person reported she played marbles and card games with eight other siblings, also reported that she and her siblings would be outdoors most of the time, as back in her day, not everyone had a TV and her family were too poor to afford one, so therefore they would play family based games where everyone could participate. She reported that she left school after year seven to help her mother with chores and look after younger siblings. She had a lot of responsibility for a kid.…

    • 1381 Words
    • 6 Pages
    Good Essays
  • Satisfactory Essays

    unit 3

    • 313 Words
    • 2 Pages

    6. Write a pseudocode statement that declares the variable total so it can hold real integers. Initialize the variable with the value 0.…

    • 313 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Pt1420 Unit 6 Paper

    • 318 Words
    • 2 Pages

    1. The state of Florida is amongst 16 other states that selects judges through the method “appointment-retention election”. A method in which a proposing group shows names to the governor, who then makes the appointment; appointees need to win a retention vote in the next election. It is not necessarily a good system because the selection is placed in the hands of the judges or attorneys who comprise the nominating committee and the governor, with only a impression of voter input. Reorganizers argue that the plan eliminate judges from politics and saves the electorate the problem of voting on judicial candidates when they know little about their professional qualifications.…

    • 318 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    This Is a Paper

    • 469 Words
    • 2 Pages

    * The design is not robust as there are no statements for error handling and handling exceptions. To make this code more robust I would add error handling statements like the user can only enter numbers that are between 0 and 100. Also the user cannot enter any strings like winding and other data types, for other numbers and data types the system will display "invalid input. Please enter a number between 0 and 100." Also notice that it doesn't handle the case of entering 49. You need <= 49, as it is now, when you enter 49 all it will say is "how did u do?" same thing with entering 100 and for anything over 100.…

    • 469 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Pt1420 Unit 2 Assignment

    • 633 Words
    • 3 Pages

    Write a minimum 200-word response to the following questions. The minimum word count is for the entire assignment, not each question. Support your response using proper APA citations and references. Provide a minimum of 1 source (citations and reference) other than the textbook from the library, your readings and video materials.…

    • 633 Words
    • 3 Pages
    Satisfactory Essays
  • Good Essays

    The loop statement will continue to run until a certain condition is met, and the while statement will continue to run while a certain condition is still true. You can tell the number of times a loop statement will repeat itself, while you are unable to tell for the while statement.…

    • 610 Words
    • 3 Pages
    Good Essays