Display a welcome message and a menu of operations

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

Programming Assignment: Maps

Introduction -

It is important to acknowledge sources. The initial idea for this assignment was taken from one created by Baker Franke.

This assignment deals with a height map. This is a map showing height of a geographical area. This type of map can be used to represent terrain. It depicts the terrain using a grid, with each location of the grid ascribed a height.

Much of the assignment is based on tracing the path a person should take if they walked over the map. However, the assignment starts with reading a sequence of numbers from a file into an array and then displaying these numbers.

The assignment is separated into separate grade bands. Complete in full the goals of the lower grade band before moving onto the next.

Learning Outcomes -

  • To develop the student's software design skills
  • To build on the student's introductory programming skills to produce solutions to more complex problems.
  • To introduce the student to advanced programming techniques in preparation for study of an advanced programming module.

Map Format

  • Each of the files represents one height map of a region.
  • The numbers are listed on 9 lines, with 9 integers per line.
  • In effect the numbers are sorted into a 9 x 9 grid.
  • The file will therefore list 81 numbers.
  • The maps are always 9 by 9.
  • The later parts of the assignment mention coordinates. The coordinates merely identify the particular square. The coordinates are given in the form: row, column (if it helps you can alternatively think of them as x and y).

Assignment Requirements -

Basic Requirements to get 45% -

The code that you submit must compile without errors.

Display a welcome message and a menu of operations (see below).

Prompt the user to select one of the operations:

  • Prompt for file name. Read a map file.
  • Display the map to screen.
  • Quit the program.

Use "map1.txt" as your map file. For the basic requirements this file will not change.

You must read the numbers into an array.

You must comment your code. Your comments must be clear and must describe the operations of your code.

Lower second classification to get 55% -

You must complete the criteria from the lower band.

For this grade classification the indices of the array must correspond to the coordinates of the map. However, you must also ensure that when you display the map it is the correct way up.

290

279

274

270

264

271

277

282

290

285

279

274

268

272

274

279

283

291

285

279

276

276

270

275

277

281

290

285

279

275

275

270

273

279

283

291

280

279

265

265

270

275

280

282

292

275

270

265

262

260

265

272

281

285

285

279

270

264

271

276

280

285

291

285

279

270

268

266

275

279

284

291

285

279

270

266

271

276

279

285

290

Note that this version is coloured so that can see the relative heights more clearly. I am not expecting to see a coloured table!

Add a new option called mountain pass.

Imagine using a mountain pass to cross over the map from one side to another. The walker wants to travel from the top side of the map to the bottom but they also want to take the easiest route.

Prompt the user for a staring location on the top hand side. By default start at the middle location on the top. This would be coordinate (8, 4)

End anywhere on the bottom of the map.

The algorithm is quite simple:

  • Choose a successor location from a square downwards: either the location directly to the bottom, or the one down and left or the one down and right (i.e. to the bottom: diagonally or orthogonally).
  • Always choose the square which has the lowest value.
  • Carry on until you reach the bottom.

Print out the height of each square as the walker enters it. For "map1.txt" the output on the screen would therefore read: 264 268 270 270 265 260 264 266 266

290

279

274

270

264

271

277

282

290

285

279

274

268

272

274

279

283

291

285

279

276

276

270

275

277

281

290

285

279

275

275

270

273

279

283

291

280

279

265

265

270

275

280

282

292

275

270

265

262

260

265

272

281

285

285

279

270

264

271

276

280

285

291

285

279

270

268

266

275

279

284

291

285

279

270

266

271

276

279

285

290

The other additional elements for this grade concern code style and layout:

No use of global variables.

Use functions/methods to separate your code into sensible, reusable parts. Comment these functions appropriately.

Your code must be properly indented and laid out so that it is readable.

  • Brackets must line up (and should normally be on a line of their own).
  • Indentation must be consistent.
  • Appropriate use of white space should be made.
  • Over-long lines of code or comments should be split up

You should have no "magic numbers" but instead make proper use of constants.

Variable names should be meaningful.

Your code should be commented appropriately.

You should make proper use of arrays, with loops to process them.

Upper second classification to get 65% -

You must complete the criteria from the lower bands.

A height map has a number of similarities to a bitmap image, such as a .bmp file. A height map can be considered to be a picture of the landscape. The map therefore lends itself to series of image manipulations.

Add new options to your menu perform the following operations on the current map:

  • Rotate the map by 90 degrees clockwise.
  • Reflect the map vertically.
  • Flip the map over the diagonal which runs from top-left to bottom-right. Formally this is a transpose operation.

First classification to get 75% -

You must complete the criteria from the lower bands.

Add Create Lake as an option to your menu. Let the user specify the map, starting location and depth. Include a default for the option. If the user presses "return" rather than entering any values then a default set of values is used: map2.txt 4 4 300

Imagine that water is pouring into the default location of the centre square of the map ( 4, 4 ).

The water will spread out from this location. It will cover any square which is below the specified depth. However, as soon as the water hits a square higher than the specified depth then it stops. The water spreads out in all directions: diagonally as well as orthogonally.

There are a variety of ways that this problem can be tackled. In effect what I've asked for is a flood fill operation so feel free to look up algorithms to implement a flood fill.

However, for the purposes of this assignment it is also perfectly OK to use a brute force solution.

Overwrite water locations with the number 000. Display the map after the lake has been formed.

Note that if you use map3.txt and fill anywhere except the centre you can create an island rather than a lake!

This is what map2.txt would look like using the default values:

355

355

352

357

351

356

351

357

352

351

351

343

339

000

301

314

339

343

350

350

341

310

305

000

000

310

341

351

351

343

000

000

000

000

000

343

352

352

342

310

000

000

000

000

342

355

355

000

341

314

000

000

000

341

351

351

000

000

000

000

000

000

345

351

351

344

310

305

310

305

310

344

360

310

295

290

315

305

315

326

355

The map has been coloured to highlight the effect.

Note the way that the locations along the bottom haven't been filled with water even though they are lower than 300. The reason for this is that they are not directly connected to the lake. The locations in seventh row act effectively act as a wall.

Mid First classification to get 85% -

  • You must complete the criteria from the lower bands.
  • Full use of object-oriented methods throughout.
  • Use classes and methods.

High First classification -

You must complete the criteria from the lower bands.

Add Steepest Ascent Hill Climbing as an option to your menu. Steepest Ascent Hill Climbing is a search or pathfinding technique. Steepest Ascent Hill Climbing is a variant of Hill Climbing, and you might want to look at both of them.

Let the user specify the map, and starting location. Include a default for the option. If the user presses "return" rather than entering any values then use default values of: map3.txt 8 4

Identify the highest location on the map.

  • The goal of the walker is to walk to the highest location. The highest location is height 410. You stop searching when the walker reaches this height.
  • Choose a successor location from any surrounding locations to the location you are currently evaluating. In other words a successor can be any of the 8 surrounding locations.
  • Evaluate not just the immediate locations to your current location, but every possible successor location which you've found.
  • Always choose the location which has the highest value.
  • Carry on until you reach the highest point on the map.

Do some research yourself on the hill climbing algorithm. It is possible to implement a search tree in order to solve the problem. However, I would suggest using a brute force method in which you record all the locations the walker has visited in order to choose the best path.

Print out the height of each square as the walker enters it. For "map3.txt" the output on the screen would therefore read: 355 365 373 390 396 395 391 388 410.

Attachment:- Assignment Files.rar

Reference no: EM132242369

Questions Cloud

How does the law in your jurisdiction follow court decision : In what ways do you foresee the law expanding to include other circumstances where healthcare providers may have a duty to warn third parties?
Describe the effects of pressure groups on trade policies : Describe the effects of pressure groups on trade policies.
Critical analysis of marketing theory : MKT7003 Marketing - CARDIFF SCHOOL OF MANAGEMENT — GULF COLLEGE - Individual Report - A critical analysis of marketing theory concerning satisfaction, loyalty
Explain which is a better accountability of measure : Analyze and explain which is a better accountability of measure, external or internal controls or the character of the administrator.
Display a welcome message and a menu of operations : CO1401 Programming Assignment: Maps. The initial idea for this assignment was taken from one created by Baker Franke. Display a welcome message
Research and development-purchasing-marketing : "Research and Development (in %)" Purchasing ( in sqft) Marketing ( in %) Human Resource Management (in labor hours) Accounting and Finance
Discuss basic categories of risk management activities : Ascertain the importance of each of the four (4) basic categories of risk management activities discussed in Chapter 10 of the textbook.
Discuss what you hope to gain from the course : Understanding the role of diversity involves some self-reflection. Self-reflection helps in understanding the framework from which you perceive yourself.
Describing six of your initial impressions of the article : Record and describe six of your initial impressions of the article in a journal format. Critically analyze each of these impressions and determine.

Reviews

len2242369

2/25/2019 9:09:59 PM

It is important to acknowledge sources. The initial idea for this assignment was taken from one created by Baker Franke. This assignment deals with a height map. This is a map showing height of a geographical area. This type of map can be used to represent terrain. It depicts the terrain using a grid, with each location of the grid ascribed a height. Much of the assignment is based on tracing the path a person should take if they walked over the map. For example, you are asked to calculate the mountain path across the map. Later parts of the assignment also include manipulating the map, flooding it with water, and find the best route up a mountain.

len2242369

2/25/2019 9:09:50 PM

However, the assignment starts with reading a sequence of numbers from a file into an array and then displaying these numbers. The assignment is separated into separate grade bands. Complete in full the goals of the lower grade band before moving onto the next. This is an individual project and no group work is permitted. Do not diverge from the assignment specification. If you do not conform to the assignment specification then you will lose marks. You must use C++. You are allowed to ask for help and feedback.

len2242369

2/25/2019 9:09:41 PM

Deliverables, Submission and Assessment - You need to submit your source code and demonstrate your working program in the lab session. Submission is electronic, via Blackboard. You must upload a text file. Upload the code you have written in a single file. (For this assignment, even if you know how, you are not permitted to have multiple source files.) The easiest way to do this is to rename your source code file. The source code is in a file in your project folder. It has a .cpp extension. Simply change the extension to .txt and then upload the file to Blackboard. Assessment will be by demonstration in your usual lab session during the week immediately after the electronic submission (i.e. the week beginning).

len2242369

2/25/2019 9:09:34 PM

Demonstration - You must demonstrate your program to your practical tutor. You must also show your code to your tutor. You will be asked questions about your code. Be prepared to answer them. You may be asked to explain what is happening, or to describe what a line of code does. If you cannot answer satisfactorily then you will be asked to attend an interview with the module tutor. Resources - This assignment has an associated set of text files. The files can be found inside the assignment folder Web-CT.

len2242369

2/25/2019 9:09:26 PM

Submissions should be made via the link on the module Blackboard page. Submissions are automatically checked for plagiarism by TurnItIn. Ensure your name and student ID is stated at the top of your code. You may only submit one file: Upload a text file with your code in it. This file should contain all your code for the assignment. Ensure that your code just runs without the need to modify it. You will demonstrate the code in your normal lab in the week of the assignment deadline, i.e. i.e. the week beginning. The same rules of lateness apply to the demonstration as to handing in your work. If you do not turn up to demonstration then your assignment will be treated as late.

len2242369

2/25/2019 9:09:19 PM

Basic Requirements - Read in “map1.txt” from file and display it to screen. Check comments. Lower second Print out the mountain path. Good code style, brackets, indentation, no magic numbers, meaningful names, comments, use of array and loops. Upper second - Rotate the map 90 degrees. Reflect the map vertically. Flip the map over the diagonal.

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