CPSC 350: "Do You See What I See?" Assignment

Choose a study mode

Play Quiz
Study Flashcards
Spaced Repetition
Chat to Lesson

Podcast

Play an AI-generated podcast conversation about this lesson
Download our mobile app to listen on the go
Get App

Questions and Answers

What is the primary purpose of the MonoStack class in this assignment?

  • To ensure that all values in a stack are unique.
  • To maintain a stack of elements in either monotonically increasing or decreasing order. (correct)
  • To implement a LIFO data structure without any restrictions.
  • To store the heights of people in the conference room.

In the context of the assignment, what input is provided to the SpeakerView class?

  • A single integer representing total number of attendees
  • A text file containing the heights of people in the order they are seated. (correct)
  • A list of names of the speakers giving presentation.
  • A configuration file which dictates the dimensions of the conference room..

How does a monotonically decreasing stack ensure its property when a new element 'X' is pushed?

  • It adds 'X' to the top without any checks.
  • It removes all elements in the stack that are smaller than 'X' before pushing 'X'. (correct)
  • It removes all elements in the stack that are larger than 'X' before pushing 'X'.
  • It removes duplicates of 'X' from the stack.

What should the main function primarily do in this assignment?

<p>Read the input file and compute the output using the <code>SpeakerView</code> class. (D)</p> Signup and view all the answers

Why are event planners concerned about the seating arrangement?

<p>To prevent shorter audience members' views from being blocked by taller ones. (A)</p> Signup and view all the answers

When should in-code citations be used?

<p>For any code that the programmer did not write themselves. (C)</p> Signup and view all the answers

What is the format of the input file?

<p>A plain text file with 'BEGIN' and 'END' delimiters, and heights separated by spaces. (A)</p> Signup and view all the answers

Which standard is used to grade the code?

<p>The presence of meaningful comments and an elegant object-oriented solution. (C)</p> Signup and view all the answers

What constitutes a 25% deduction from the grade?

<p>Not following the assignment specifications exactly. (B)</p> Signup and view all the answers

What should the README file contain?

<p>Full name, student ID, Chapman email, course number and section, assignment or exercise number, a list of all source files submitted for the assignment, a description of any known compile or runtime errors, code limitations, or deviations from the assignment specification (if applicable), a list of all references used to complete the assignment, including peers (if applicable). (C)</p> Signup and view all the answers

Flashcards

Monotonic Stack

A stack that maintains elements in monotonically increasing or decreasing order.

Monotonically Increasing Stack

Ensures elements in the stack are always increasing from bottom to top.

Monotonically Decreasing Stack

Ensures elements in the stack are always decreasing from bottom to top.

LIFO Data Structure

A data structure where the last element added is the first one removed.

Signup and view all the flashcards

SpeakerView Class

A class that takes a text file of heights, uses a monotonic stack to determine visible people in each column, and displays the results.

Signup and view all the flashcards

In-code Citations

Code from external sources used in assignments must be properly acknowledged. Wrap the copied code in comments denoting the start and end of said code.

Signup and view all the flashcards

Study Notes

  • Programming Assignment 3 is titled "Do You See What I See?" for CPSC 350, Spring 2023

Clarification Example

  • If the input is between BEGIN and END, each row is a row in the audience.

Output Example

  • For a sample input, the number of people who can see in each column and their heights are given as an output example.
  • In column 0 there are 2 that can see with heights 81.4 and 90 inches.
  • In column 1 there is 1 that can see with a height of 121.4 inches.
  • In column 2 there are 4 that can see with heights 50.2, 80.2, 90.7 and 92.6 inches.
  • In column 3 there are 2 that can see with heights 75.3 and 89.9 inches.
  • In column 4 there are 3 that can see with heights 75.1, 94.7 and 95.1 inches.

Assignment Details

  • A company is using a celebrity speaker and wants to arrange seating in an N x P rectangle.
  • Planners want to ensure shorter audience members can see the speaker.
  • A text file with N lines and P entries representing heights will be provided.
  • The task is to determine how many people in each column have an unobstructed view of the speaker.

Problem Solving with Stacks

  • A monotonic stack has elements in monotonically increasing or decreasing order from bottom to top and duplicate values are not allowed.
  • Monotonic stacks are LIFO data structures, focus should be put into the push function to maintain order.
  • For an increasing stack, to push value X, pop values larger than X.
  • For a decreasing stack, to push value X, pop values smaller than X.
  • A templated MonoStack class should be built.
  • The constructor should take initial size and a character 'o' for increasing ('i') or decreasing ('d').
  • Error conditions should be handled appropriately.

Program Requirements

  • Build a SpeakerView class that takes a text file of N+2 lines.
  • The first line is "BEGIN" and the last line is "END".
  • The N lines between contain P doubles (heights) separated by spaces.
  • A monotonically decreasing stack should be used.
  • Determine the number of people who can see the speaker in each column, along with their heights.
  • Descriptive output should be displayed to the terminal.
  • The SpeakerView class should be object-oriented.
  • A main.cpp file should be made that takes the input file name as a command line argument and uses the SpeakerView class.

Rules of Engagement

  • Primitive data structures like vectors and lists are prohibited, a monotonic stack implementation must be used.
  • This assignment is individual work.
  • VSCode and the course docker container should be used to develop and run code.
  • Textbooks and Internet sites may be used, with citations in a README file, all code must be original.
  • The g++ command for compiling code should also be within the README

Due Date and Grading

  • The assignment due date will be on Canvas.
  • Commented code should be submitted as a zip file named LastName_FirstInitial_A3.zip
  • Grading will be based on correctness, guidelines, and code quality, with credits for elegant OO solutions.
  • Following the C++ style guide is expected.
  • Code that does not follow specifications receives a 25% deduction and a 50% deduction for code that doesn't compile.

Readme File

  • A plain text README file is needed that contains:
    • Identifying information (full name, student ID, Chapman email, course number/section, assignment/exercise number)
    • A list of submitted source files
    • Descriptions of compile/runtime errors, code limitations, or deviations
    • A list of all references, including peers
    • Instructions for running the assignment, including compile and run commands
  • Example compile: g++ *.cpp -o A1.exe
  • Example run: ./A1.exe input.txt output.html

In-Code Citations

  • Small, isolated lines of external code are permitted with appropriate citations that include:
    • The start and end of the copied code must be wrapped with comments denoting the source.

Header Comments

  • All source files should start with a header comment that includes:
    • Full name, student ID, Chapman email, course number/section, assignment/exercise number (each on a new line)

Studying That Suits You

Use AI to generate personalized quizzes and flashcards to suit your learning preferences.

Quiz Team

Related Documents

More Like This

Use Quizgecko on...
Browser
Browser