Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

While-End Loop (Repetition Structure)

 

1592_Figure.png

Create your own simple program using a repetition (i.e., Loop) structure. You decide the theme. Provide an overview (i.e., Program Design) of what your repetition structure is doing. Then provide the Pseudocode of your example.  Please keep the design simple for this exercise. Just a few lines of code is all that is needed for this response.

First, write using a for loop for a fixed number of loops.

Then for the same program use a While loop with a sentinel approach.

When using the While loop, you will need some logic to exit the loop and you will need a loop counter.

You could take one of your prompts from Road Trip and create a loop around it.

I don't want to see just a loop where you just print out the loop counter.

Some suggestions:

1) Prompt for mileage run daily, count the days, and calculate the ave miles per day, display total miles and ave daily miles

2) Prompt for grocery costs per week, count the weeks, calculate the ave grocery costs per week, display total grocery costs and ave grocery costs

3) Prompt for car miles driven in a month, count the months, and calculate the ave miles driven per month, display total miles and ave monthly miles driven

4) Prompt for number of movie tickets sold in a night, count the number of nights, calculate the ave tickets sold per night, display the total tickets sold and the ave tickets sold per night.

Remember--- The accumulation of total is done inside the loop. To calculate ave you divide the accumulated total by the number of whatever you are looping. The ave is done after the end of the loop.

2: Convert Part 1 to C-code. You only need to do one of the loop types.  Don't for get to indent your code.  Put Part 2 - problem no. X in the Subject area and submit a .txt (or .c) file for your code.

3: Take your While-End repetition structure from Part 1 and modify it so that the While condition test uses a Boolean variable. You will need to initialize the Boolean variable prior to the loop as well as set it inside the loop so that you exit the loop appropriately.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M92016867
  • Price:- $25

Priced at Now at $25, Verified Solution

Have any Question?


Related Questions in Computer Engineering

Strategies when resources are constraineda project manager

Strategies When Resources Are Constrained A project manager has fewer options for accelerating project completion when additional resources are either not available or the budget is severely constrained. This is especial ...

Question task 1 use examples from the readings or from your

Question: Task 1: Use examples from the readings, or from your own research, to support your views, as appropriate. Encouraged to conduct research and use other sources to support your answers. Be sure to list your refer ...

Going to concerts and reading books take time and money

Going to concerts and reading books take time and money. Suppose a book costs $10 and takes 3 hours to read and a concert costs $20 and takes 3 hours. For a person with $80 to spend and 18 hours for these activities: a. ...

Question cyber attacks on critical infrastructures-a risk

Question: Cyber Attacks On Critical Infrastructures-A Risk To The Nation There has been a great deal of research related to cyber attacks and vulnerabilities and critical infrastructure, but there is an incomplete unders ...

Determine the mass of the water by using the waters density

Determine the mass of the water by using the water's density (specific to the initial temperature) and the volume of the water. Remember,  density = mass/volume . You can look up the density of the water at your specific ...

Question what is the smallest value of n such that an

Question : What is the smallest value of n such that an algorithm whose running time is 1000n 2 runs faster than an algorithm whose running time is 4 n & on the same machine? Justify your answer. The response must be typ ...

What is the role of arp and how does it cause a security

What is the role of ARP and how does it cause a security concern? What is the different between global and private IP addresses? How does using NAT change a private IP address into a global IP address, and why is this so ...

Question suppose that during document indexing we are

Question : Suppose that during document indexing we are interested in identifying all dates in the format mm/dd/yyyy, where mm is a 2 digit string representing the month (ranging from 01 through 12), dd is a 2-digit stri ...

According to a recent article the average number of babies

According to a recent article the average number of babies born with significant hearing loss (deafness) is approximately four per 1,000 babies in a healthy baby nursery. The number climbs to an average of 30 per 1,000 b ...

How can i get the first element from a linked listfor

How can I get the first element from a linked list? For example, if I am working on a number guessing game with linked list, and there is a list called priorGuess, which stores all the guesses that is given. PriorGuess h ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As