Ask Homework Help/Study Tips Expert

Object-Oriented Programming for Electrical and Computer Engineers

Exercise 1 - Random Walk

The following figure illustrates a random walk on an integer grid. You begin at the position Start and you are trying to get to the position Finish. Each time you reach a corner, you choose a direction at random, and take a unit step in that direction. You never wander outside the grid. So, if you are at the Start position, you have a choice of two directions: left and down. You choose one of these at random. If you are in the middle of the grid, you have a choice of four di¬rections: left, right, up and down. You choose one of these at random. Write a program to simu¬late the random walk, stopping when you reach the destination. Utilize the function rand () to generate a random number. Choose an N x N grid of size say N = 8.

Exercise 2 Standard Template Library (STL)

1. Create a Person class, with the person's name, age and the town of residence as the data members. Then create an STL deque of Person objects (≈ 5 objects). Display the contents of the deque.

2. In this problem, you will be utilizing STL vector. Noah and Sofia want to invite their friends to a party. Write a program which does the following:

- Reads the list of Noah's friends names, stores it in a vector, and displays it in sorted order.
- Reads the list of Sofia's friends names, stores it in a second vector, and displays it in sorted order.
- Creates a third vector, merges the contents of the previous two vectors, eliminates duplicates, and displays this list.Assignment 3
Standard Template Libraries (STLs) and Inheritance

Assignment

1. Write an algorithm to print different ways of arranging 4 rooks on a chess board, so that no rook can capture another. That is, none of them share the same row or column. Generate and display a few test cases.

2. Write a program to read in names and scores of N students, from a file. Then find the me- dian of all the scores. Utilize the STL container map. The scores should be in the range [0, 100]. As an example, you may use N = 10;

3. (a) Create an STL set S1 with N1 elements in the range [0, 400].
(b) Create an STL set S2 with N2 elements in the range [200, 600].
(c) Find the intersection of S1 and S2.
(d) Find the union of S1 and S2.
As an example, use N1 = 50, and N2 = 60.

4. Stephen Prata, Chapter 13, Programming Exercise 1 on base class Cd and derived class Classic.

Homework Help/Study Tips, Others

  • Category:- Homework Help/Study Tips
  • Reference No.:- M92778775
  • Price:- $45

Priced at Now at $45, Verified Solution

Have any Question?


Related Questions in Homework Help/Study Tips

Review the website airmail service from the smithsonian

Review the website Airmail Service from the Smithsonian National Postal Museum that is dedicated to the history of the U.S. Air Mail Service. Go to the Airmail in America link and explore the additional tabs along the le ...

Read the article frank whittle and the race for the jet

Read the article Frank Whittle and the Race for the Jet from "Historynet" describing the historical influences of Sir Frank Whittle and his early work contributions to jet engine technologies. Prepare a presentation high ...

Overviewnow that we have had an introduction to the context

Overview Now that we have had an introduction to the context of Jesus' life and an overview of the Biblical gospels, we are now ready to take a look at the earliest gospel written about Jesus - the Gospel of Mark. In thi ...

Fitness projectstudents will design and implement a six

Fitness Project Students will design and implement a six week long fitness program for a family member, friend or co-worker. The fitness program will be based on concepts discussed in class. Students will provide justifi ...

Read grand canyon collision - the greatest commercial air

Read Grand Canyon Collision - The greatest commercial air tragedy of its day! from doney, which details the circumstances surrounding one of the most prolific aircraft accidents of all time-the June 1956 mid-air collisio ...

Qestion anti-trustprior to completing the assignment

Question: Anti-Trust Prior to completing the assignment, review Chapter 4 of your course text. You are a manager with 5 years of experience and need to write a report for senior management on how your firm can avoid the ...

Question how has the patient and affordable care act of

Question: How has the Patient and Affordable Care Act of 2010 (the "Health Care Reform Act") reshaped financial arrangements between hospitals, physicians, and other providers with Medicare making a single payment for al ...

Plate tectonicsthe learning objectives for chapter 2 and

Plate Tectonics The Learning Objectives for Chapter 2 and this web quest is to learn about and become familiar with: Plate Boundary Types Plate Boundary Interactions Plate Tectonic Map of the World Past Plate Movement an ...

Question critical case for billing amp codingcomplete the

Question: Critical Case for Billing & Coding Complete the Critical Case for Billing & Coding simulation within the LearnScape platform. You will need to create a single Microsoft Word file and save it to your computer. A ...

Review the cba provided in the resources section between

Review the CBA provided in the resources section between the Trustees of Columbia University and Local 2110 International Union of Technical, Office, and Professional Workers. Describe how this is similar to a "contract" ...

  • 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