Create an algorithm that displays the average of numbers

Assignment Help C/C++ Programming
Reference no: EM132330012

*Question 1. Harold is five steps away from his cat Ginger, who is an unknown distance away from a chair, as illustrated in Figure 1-8. Using only the instructions listed in the figure, create an algorithm that directs Harold to step over Ginger and sit in the chair. You may use an instruction more than once. In the repeat (x times) instruction, replace x with the appropriate number of times you want the loop instruction(s) repeated. Be sure to indent the instructions appropriately. (The answers to TRY THIS Exercises are located at the end of the chapter.)

459_CrazyTalk Animator.jpg

Figure 1-8: CrazyTalk Animator

*Question 2. A store gives a 15% discount to customers who are at least 55 years old, and a 10% discount to all other customers. Using only the instructions shown in Figure 1-9, write an algorithm that displays the amount of money a customer owes. Be sure to indent the instructions appropriately. (The answers to TRY THIS Exercises are located at the end of the chapter.)

Calculate the amount due by subtracting the discount from the sales amount
Calculate the discount by multiplying the sales amount by 10 %
Calculate the discount by multiplying the sales amount by 15 %
Display the amount due
else
end if
enter the customer's age and the sales amount
If (the customer's age is less than 55 )

Figure 1-9

Question 3. Modify the algorithm shown earlier in Figure 1-5 so that it gives a 25% discount if the customer buying a TV is an employee of the store; all other customers buying a TV should receive a 15% discount.

*Question 4. Using only the instructions shown in Figure 1-10, create an algorithm that displays the average of four numbers. Be sure to indent the instructions appropriately.

calculate the average by dividing the sum by 4
calculate the sum by adding the number to the sum
display the average
end repeat
enter a number
repeat (4 times)

Figure 1-10

Question 5. You have just purchased a new personal computer system. Before putting the system components together, you read the instruction booklet that came with the system. The booklet contains a list of the components that you should have received. The booklet advises you to verify that you received all of the components by matching those that you received with those on the list. If a component was received, you should cross its name off the list; otherwise, you should draw a circle around the component name in the list. Using only the instructions listed in Figure 1-11, create an algorithm that shows the steps you should take to verify that you received the correct components. Be sure to indent the instructions appropriately.

Circle the component name on the list
cross the component name off the list
else
end if
end repeat
if (the component was received)
read the component name from the list
repeat for (each component name on the list)
search for the component

Figure 1-11

*Question 6. Using only the instructions shown in Figure 1-12, write two versions of an algorithm that displays the total amount each customer owes for concert tickets. Be sure to indent the instructions appropriately.

calculate the amount owed by multiplying the number of tickets by $35
display the amount owed
display the message "you can purchase up to 4 tickets only."
else
end if
end repeat
enter the number of tickets
If (the number of tickets is greater than 4)
if (the number of tickets is Less than or equal to 4)
repeat for (each customer)
figure 1-12

Question 7. Harold is standing in front of a flowerbed that contains six flowers, as illustrated in Figure 1-13. Create an algorithm that directs Harold to pick the flowers as he walks to the other side of the flowerbed. He should pick all red flowers with his right hand. Flowers that are not red should be picked with his left hand. Use only the instructions shown in the figure; however, an instruction can be used more than once. Be sure to create an algorithm that will work for any combination of colored flowers.

*Note: only need problems 1,2,4,6,8.

Reference no: EM132330012

Questions Cloud

Define the nurse manager skills inventory : Rate yourself using the results from the "Nurse Manager Skills Inventory". Write a reflection of 750-1,000 words in which you identify your strengths.
How has GoPro gained a competitive advantage : MNG91002 Entrepreneurship - Southern Cross University, Australia. How has GoPro gained a competitive advantage from their marketing processes
Define benefits of effective interdisciplinary collaboration : Explain the concept of true collaboration in health care and describe the benefits of effective interdisciplinary collaboration.
What can one do to become culturally aware : How does cultural competency occur? What can one do to become culturally aware? Describe an effective approach to using The Purnell Model when working.
Create an algorithm that displays the average of numbers : Write two versions of an algorithm that displays the total amount each customer owes for concert tickets. Be sure to indent the instructions appropriately
Define advance leadership roles to initiate and guide change : Assumes complex and advanced leadership roles to initiate and guide change. Provides leadership to foster collaboration with multiple stakeholders.
Prepare a detailed response to the Chairman and the board : Holmes Institute - HA2032 Corporate and Financial Accounting Assignment - Corporate Takeover Decision Making and the Effects on Consolidation Accounting
Construct a stem-and-leaf plot : Construct a boxplot using your calculator, and make a rough sketch of the boxplot. State whether or not the data came from a population.
Why firm understanding important on all information systems : Why is it important to have a firm understanding on all information systems, regardless of department you work in? Provide details. The response must be typed.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd