Searching and Sorting Arrays SOlution

$30.00

Description

Goals:

  • Searching through arrays
  • Sorting arrays with bubble and selection sorts

Development Environment: (all students must use Visual Studios)

Skills: arrays, searching sorting, functions,

Reading: Chap 7, Chap 8

Deliverables: 1) This lab with two screen shots 2) lastnameFirstLab08.cpp

Part I – Skills Practice (10 points)

  • Open a new project in Visual Studios. Call the project Lab08. Don’t forget to uncheck the Pre-compiled headers and Security Development Lifecycle checks. Check the box for an empty project

You will be creating 4 files called lab08a.cpp, Car.h and CarFunctions.h, CarFunctions.cpp

In Car.h. If you start with the working files from a working Lab07, you will have a lot less to type.

Create a file called Car.h under header files

 

Remember in your Car.h, you should remove the #pragma once, and add the duplicate guard:

  • Now create a file called CarFunctions.h under header files
  • Now create a file called CarFunctions.cpp under source files

a

  • Run it adding two cars. Take a screen shot of the successful output and place it below. Replace this output with your output (and 2 different cars) For a Windows 10 screen shot: Alt key + PrtSc key. Then Ctrl + V to paste. For Mac: Shift + Command + 4. You will not credit unless you have a successful screen shot with Your name in the output.

Part II – outline/pseudo-code/algorithms (5 pts)

  • Work with your lab partner to write an outline in comments and psuedocode to complete the following program. Use plain English for your outline.
  • You should have one file broken into sections with comments. Each .h and .cpp should be in a separate section. Every program you write should have the following block at the top in comments. Make sure to fill in the Name, Class, Description and Lab Partner at the top of the file. Ensure your status is accurate.

/* Name:
Class: CSCI 1411-00X
Description: [fill in description]

Lab Partner:
Status: successfully compiled and run on csegrid [if it doesn’t run or meet all of the requirements, list the actual status!/*

Part III -Movie Listing, Sorting and Searching. (10 pts)

  • Expand on Lab07a, by providing a Search and Sort Function. You should be able to Search or Sort by Title.
  • Write a program that reads in data from a file and places the information in a struct named MovieData. The input file has between zero and 100 “records” each with the all of following items (in order, separated as noted below)

Title

ReleaseYear

RunningTime

Rating

Title might have spaces in them. RunningTime is in minutes. Rating is something similar to RottenTomatoes.com, so listed in a percent.

You will have a menu that continues until your press exit, and returns an error and goes back to the menu if not one of the choices. You can assume the user will only enter integers for the menu:

  1. Read in Movies
  2. Add Movies
  3. List Movies
  4. Search Movies by Title
  5. Sort Movies by Title
  6. Exit

For ease of grading, we will have you place all of the code in a single file called yourlastnamefirstLab07.cpp. Your .cpp file should have the following format:

/* Name:
Class: CSCI 1411-00X
Description: [fill in description]

Lab Partner:
Status: successfully compiled and run on csegrid [if it doesn’t run or meet all of the requirements, list the actual status!/*

//Function Prototypes

//Function Implementations

int main()

Since they are all together in one file you not have to #include “.h” as we did in the previous lab

Like in the example declare an array in main(). Declare a MAXSIZE in main, then pass the parameters. Remember that you do not pass an array by reference, but if you are going to change the size variable when you Add, that will need to be passed by reference (& before the variable name)

When you add movies, you should add them to the next point in the array and increment the size, but should verify that you are not trying to add past the MAXSIZE of the array.

  • Run the program and take a screenshot of the output. Place it below
  • Turn in yourlastnamefirstLab08.cpp to canvas along with this lab with .