3 Pages

115 Project 02 - Snarky Burger

Course: CS 115, Fall 2009
School: Wheaton College
Rating:
 
 
 
 
 

Word Count: 700

Document Preview

Fundamentals Do Programming you want fries with that? Due Date: Tuesday, October 12, 2004 PROJECT #2 You have been hired to put together a mock-up for the cash registers at the world-famous "Snarky Burger" fast food restaurant. Your cash register program will accept the following input: A letter code indicating what item on the menu the customer wishes to order. Accept both upper and lower...

Register Now

Unformatted Document Excerpt

Coursehero

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
Fundamentals Do Programming you want fries with that? Due Date: Tuesday, October 12, 2004 PROJECT #2 You have been hired to put together a mock-up for the cash registers at the world-famous "Snarky Burger" fast food restaurant. Your cash register program will accept the following input: A letter code indicating what item on the menu the customer wishes to order. Accept both upper and lower case input. The choices are: A. B. C. D. E. Snarky burger Snarky fries Snarky soda Snarky Value Meal Snarky salad Certain choices should lead to some follow-up questions (which are not asked if the customer is not ordering such an item), each of which should have a one-letter answer (and you must accept upper OR lower case make certain you tell the user what letter you are expecting, e.g. "Enter `Y' or `y' for Yes"): Snarky burger : Do you want cheese? Snarky fries : Large or small? Snarky Value Meal : Regular or Mega Super Size? As it receives this input, the cash register needs to calculate the price of the purchase based on the following information: Food Snarky Burger Snarky fries Snarky soda Snarky Value Meal Snarky salad Option no cheese with cheese small large regular mega super size Price $0.80 $0.95 $0.75 $1.00 $1.70 $4.10 $5.00 $1.35 It should display each item and the price after it has been ordered: Snarky Burger with cheese $0.95 Extra Credit #1: Allow the user to "void" the most recent purchase and take it off. Page 1 of 3 After each item is ordered, have the cash register ask if the customer's order is complete. (Again, this should require a one-letter answer with upper or lower case both accepted.) If the order is not complete, the program should loop and ask for the next item. When the order is complete, the cash register must ask: Does the customer have a Frequent Snarker discount card? (Same rules about the answers as above.) The Frequent Snarker discount card gives a 10% discount. If it is complete, the cash register needs to take the total cost of the order, figure out the discount if the person has a Frequent Snarker card, and report the final price. The cash register should then ask for the amount money of the customer hands to the Snarky employee. This amount can be typed in as the following format: 5.50 Extra Credit #2: If the customer offers less money than the price of his/her purchase, reject the payment, and keep asking for the total amount the customer hands over until the customer has actually paid for the purchases. The cash register then prints up a receipt with the following information: SUBTOTAL $4.29 Discount Card: 10% -$0.42 TOTAL: $3.87 --------------------------------------------Cash tendered: $5.00 Change: $1.13 Note that discount amounts can be rounded or truncated; it is your choice. Note also that if the customer did not present a Frequent Snarker card, no discount information should be mentioned at all on the receipt (it should go straight to the TOTAL): TOTAL: $4.29 --------------------------------------------Cash tendered: $5.00 Change: $1.13 All prices must have a dollar sign and the decimal point must line up. Here are the niddly details of the project: Write out an algorithm first as you did last time. Turn this in by Friday, October 1, in class. This will be part of your grade. Store the prices for each item using const variables. Page 2 of 3 Use a switch/case structure to handle the initial letter code input. You can choose which structures to use in...

Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

Wheaton College - CS - 115
Programming FundamentalsCan robots walk a line? Due Date: Wednesday, October 27, 2004PROJECT #3This is now an extra credit project. Please note that the points distribution has been changed. In this project, you are going to use a Lego robot to follow
Wheaton College - CS - 115
Programming FundamentalsREVISED ROBOT PROJECT Due Date: Wednesday, October 27, 2004This is the revised robot project.PROJECT #3Your task is now to write a program assuming that the robot is starting somewhere in a box: Your robot should drive forward
Wheaton College - CS - 115
Programming FundamentalsPROJECT #4The ghost of fractions past haunted by grade school math Due Date: Friday, November 5, 2004From the darkness of your educational past, a ghost has arisen your third grade math teacher. You had hoped to forget her, but
Wheaton College - CS - 115
Programming Fundamentals(Smarter than your AVERAGE Lyon) Due Date: Tuesday, November 16, 2004PROJECT #5Once again, youre going to write a program to help out a teacher except this time, its a college professor. Your program is going to read from a data
Wheaton College - CS - 115
Programming Fundamentals(Arrayed in Your Finest) Due Date: Tuesday, November 30, 2004PROJECT #6Its your first job out of college and you get hired by a cool online company to design their ordering system! Your project will print the catalog of choices
Wheaton College - CS - 116
Pile of Dirty LaundryWow, this is quite impressive. Either the owner of these clothes has an extremely extensive wardrobe, or she must be working pretty hard these days to find something to wear. The pile has reached the height of your knees, and you hav
Wheaton College - CS - 116
/=/ COMP 116 Lecture Examples// RECURSION - main program/#include <iostream>using namespace std;/=/ defining an array to demonstrate these/#define ARRAY_SIZE 15int SortedArray[] = cfw_ 1,3,6,8,10,22,34,45,60,67,72,76,89,92,100;int RandomArray[
Wheaton College - CS - 116
Data StructuresSTL iterator examples#include <stdlib.h> #include <vector> int main() cfw_ vector<char> name; vector<char>:iterator i; vector<char>:reverse_iterator r; char c; / obtain contents of name vector cout < "Enter your name & hit return: "; do c
Wheaton College - CS - 116
Data StructuresSTL vector classAN INTRODUCTION TO STL VECTORS URL for more info: http:/www.sgi.com/tech/stl/ Vector.htmlHandoutAs introduced in lecture, a vector can be seen mostly as a dynamic array. It is an ordered sequence, it can be randomly acce
Wheaton College - CS - 116
Data Structurespoint class (overloaded operators)Handout/ flower.h : a class to hold information about a flower.#include <string> class flower cfw_ public: float GetPollenAmount(); bool operator=( const flower& ); flower& operator=( const flower& ); p
Wheaton College - CS - 116
Data Structurespoint class (overloaded operators) point.h:Handout/ point.h : Defining a class to store the x,y coordinates in a plane / includes overloaded operators for input, output, comparison, / addition, and assignment #include <iostream> class po
Wheaton College - CS - 116
Data Structuresreview class review.h:Handout/ review.h : defines a class to store a review of a computer game / for a website on gaming. / possible genres of computer games enum GenreType cfw_FPS, RPG, ADVENTURE, PUZZLE, STRATEGY, SIM, ACTION; / minimu
Wheaton College - CS - 255
Computer Science 255: Artificial IntelligenceProlog Due Date: Fri, 2/29/08 Name your Prolog source file YourlastnameHW4.pl and submit it to my dropbin when you are completed. Comment each predicate as you would comment a function/method and include a sta
Wheaton College - CS - 255
Computer Science 255: Artificial IntelligenceKnowledge Representation Due Date: Wednesday 4/9/08 1. (20 points) Come up with a script representation of a process you deal with on a regular basis, constructed of a minimum of 4 scenes, using the same forma
Wheaton College - CS - 255
Computer Science 255: Artificial IntelligenceScripts ExampleScripts Handout Page 1 of 2Scripts Handout Page 2 of 2
Wheaton College - CS - 255
Computer Science 255: Artificial IntelligenceNatural Language Processing ExamplesPronoun resolution examples1. John and Mike: a. He has been acting quite odd. He called up Mike Yesterday. John wanted to meet him quite urgently. b. He has been acting qu
Wheaton College - CS - 255
Computer Science 255: Artificial IntelligenceIntroduction to PrologBasic Prolog Syntax Programs are made of two kinds of sentences, including facts, simple predicates that are true about the world and the objects in it: male(fred). male(bob). male(frank
Wheaton College - CS - 255
Computer Science 255: Artificial IntelligenceMore Forward and Backward ChainingFrom Lewis Carrolls Logic Puzzles: No interesting poems are unpopular among people of real taste. [1] x Interesting(x) Popular(x) No modern poetry is free from affectation. [
Wheaton College - CS - 255
ComputerScience255:ArtificialIntelligenceBackward ChainingBackward chaining uses Modus Ponens in the opposite direction. If you want to prove Q, and you know that P Q .then you try to prove P, and that will prove Q. The general approach is the following
Wheaton College - CS - 255
Computer Science 255: Artificial IntelligenceForward ChainingRecall that Modus Ponens says that if you have the implication P Q And you know that P is true, then Q must be true. The way forward chaining works is the following: Find all implications in y
Wheaton College - CS - 255
ComputerScience255:ArtificialIntelligenceLogical InferenceAND-INTRODUCTION: If you have two sentences each which are known to be true: P is true Q is true Brilliant( Mary ) Funny( Mary ) Mary is brilliant. Mary is funny.then you know their conjunction
Wheaton College - CS - 255
Computer Science 255: Artificial IntelligenceFirst Order (Predicate) Logic"ATOMIC" SENTENCES in First-Order Logic: Indivisible propositions which are either TRUE or FALSE. They are written as predicates and usually express a fact, or a relationship, abo
Wheaton College - CS - 255
Computer Science 255: Artificial IntelligencePropositional Logic"ATOMIC" SENTENCES: Indivisible propositions which are either TRUE or FALSE. Usually expresses a fact, or a relationship. Noah is cute. Malory is Lisa's pet. Noah plays with a ball. Sue gav
Wheaton College - CS - 106
The BASICS of COMPUT I NGdue Friday, 9/21/071. (1 pt) General gate questions:HW #3: Logica. What are the three notational methods for describing the behavior of gates and circuits? What is the common information which is conveyed in different ways in
Wheaton College - CS - 106
The BASICS of COMPUTINGdue Friday, 10/5/07HW #5: Objects and Methods1. (1 pt) If we are given an object called human which has the following subparts: head body And the head had the following subpart: eyes While the human had the following properties:
Wheaton College - CS - 106
The BASICS of COMPUT I NG HW #6: If/else and More Objectsdue Friday, 10/12/071. (2 pts) Pick the letter below that best fits the description: A. Variable B. Property C. Method D. Function E. Expression a. b. c. d. e. f. g. h. An instruction that returns
Wheaton College - CS - 106
The BASICS of COMPUT I NGdue Friday, 10/19/07HW #7: Loops1. (1 point) Identify each of these as being an (E)vent controlled loop, or a (C)ounter controlled loop. a. A loop which executes something 7 times every time you run the program. b. A loop which
Wheaton College - CS - 106
The BASICS OF COMPUT I NGThe Game of PigProject #1Due: Friday, November 9In this project, you will be creating a playable version of the game PIG, in which two players roll a die in a race to get to 100 points. During a turn, a player can accumulate p
Wheaton College - CS - 106
The BASICS of COMPUT I NG WWWdue Friday, 11/16/07HW #11: Networks and the(7 pts) For the following, identify the term that goes with the description possible answers are: A. B. C. D. E. F. G. bandwidth data transfer rate HTML attribute <head></head> <b
Wheaton College - CS - 106
-Go to Main Menu <./DataArchive.html>Go to Power Search </cgi-bin/iform?DASL>Go to Datafile Subjects <./allsubjects.html>-*Datafile Name:* Hot dogs *Datafile Subjects:* Food</cgi-bin/isearchb?DATABASE=DASL&SEARCH_TYPE=boolean&ELEMENT_SET=title&MAX
Wheaton College - CS - 106
Lisa MichaudProject #2Page 1 out of 3Chart 1 : Composition of Data Set by Type31% 100% 90% 80% 70% 60% 50% 40% 30% 20% 10% 0%Chart 2 : Percentage of Hot Dogs Which are High-Calorie37% Beef Meat Poultry31%BeefMeatPoultryChart 3 : Calories by Typ
Wheaton College - CS - 106
The BASICS of COMPUT I NGExample SubmissionsProposalPROJECT #2The file I have chosen to do my analysis on is the Hot Dogs file. This file contains information about the composition type, calories, and sodium level of 54 different brands of hot dogs. T
Wheaton College - CS - 106
The BASICS of COMPUT I NGProposal Due: Friday, November 16, 2007 Final Due Date: Wednesday, November 28, 2007SummaryPROJECT #2Data Analysis and Presentation Using SpreadsheetsNow that you have some experience using a spreadsheet to do both data proje
Wheaton College - CS - 106
The BASICS of COMPUT I NGDale & Lewis Chapter 2: Number Systems Final Exam ReviewNumbers in different bases: binary, decimal, hexadecimal Conversion: from other bases to decimal, from decimal to binary Math in different bases: addition in binary Key c
Wheaton College - CS - 106
The BASICS of COMPUT I NGSQL SyntaxSQL (Structured Query Language) is a powerful language for designing databases, modifying them, and, and drawing information out of them. It provides a standardized interface between applications and the underlying inf
Wheaton College - CS - 106
The BASICS of COMPUT I NGReview of Set Notation A = cfw_1,2,3,4 xA B = cfw_3,4,5,6 xASet TheoryU = cfw_1,2,3,4,5,6,7,8,9,10 1A 1B x is a member / is not a member of set A the intersection of sets A and B A B = cfw_x : x A and x B the union of sets A
Wheaton College - CS - 106
The BASICS of COMPUT I NGPages and FramesThe idea of paging is two-fold: Demand PagingAll programs currently running and all of their data must be in the main memory, from where the Control Unit can fetch the next instruction in order to execute it. H
Wheaton College - CS - 106
The BASICS OF COMPUT I NGRecording Your Alice ProgramsIf you are using Windows, there is a freeware screen recording software called CamStudio that will allow you to make movies of your Alice programs in action to share with your friends and family who
Wheaton College - CS - 215
AlgorithmsBig O: The Upper BoundBig O and its Cousinscg(n)f(n)n n0f(n) is O(g(n) ifthere is some real constant c > 0 and some integer constant n0 0 such that f(n) cg(n) for all n n0 Big Omega: The Lower Bound f(n) cg(n)n0nf(n) is (g(n) ifthere
Wheaton College - CS - 215
AlgorithmsAssignment #1 Homework: Big "Oh" Analysis Due Friday 2/3/061. (1 point) Bill has an algorithm, find2D, to find an element x in an n n array A. The algorithm find2D iterates over the rows of A, and calls the algorithms arrayFind, of Code Fragme
Wheaton College - CS - 215
AlgorithmsAN INTRODUCTION TO STL VECTORSLab #2 STL Vectors Tuesday 2/6/06As introduced in lecture, a vector can be seen mostly as a dynamic array. It is an ordered sequence, it can be randomly accessed (using the same kind of subscripts you are used to
Wheaton College - CS - 215
AlgorithmsOBJECTIVEAssignment #2 Program: Big O Due Thursday 2/9/05Write an program to prime numbers from 2 to n, where n is entered by the user at runtime. In addition to finding (and printing) the primes, you are going to analyze the amount of work y
Wheaton College - CS - 215
AlgorithmsLab #3 STL Lists and Recursion Tuesday 2/14/06AN INTRODUCTION TO STL LISTS URL for more information: http:/www.sgi.com/tech/stl/List.html The list class in the STL is an implementation of a doubly-linked list. Unlike with a vector, you cannot
Wheaton College - CS - 215
AlgorithmsRECURSIVE FUNCTIONS FOR EXPRESSING RUNNING TIMERecurrence RelationsThe idea behind a recurrence relation is to find a way to express the running time of an algorithm in terms of n, the size of its input: TA(n) = the time it takes algorithm A
Wheaton College - CS - 215
AlgorithmsThe recurrence relation was: T(1) = 0 T(n) = 2 T(n/2) + n Expand:Solution to Practice ProblemT(n) = 2 T(n/2) + n = 2 [ 2 T(n/4) + n/2 ] + n = 2 2 T(n/4) + n + n = 2 2 T(n/4) + 2n = 2 2 [ 2 T(n/8) + n/4 ] + 2n = 2 2 2 T(n/8) + 3n Guess: k expa
Wheaton College - CS - 215
AlgorithmsWork on this problem as practice for the first midterm.Practice ProblemThe recurrence relation that expresses the running time of most efficient sort algorithms is: T(1) = 0 T(n) = 2 T(n/2) + n For example, in merge sort, you first sort each
Wheaton College - CS - 215
AlgorithmsOBJECTIVEAssignment #3 Program: Recursion Due Friday 2/24/05Write a program to find all Inverted Repeats (IRs) of a given length L in an input file of nucleotides (DNA!) in the FASTA format. The length L is determined by the user at run-time;
Wheaton College - CS - 215
AlgorithmsLab #5 STL Stacks and Depth-First Search Tuesday 3/7/06AN INTRODUCTION TO STL STACKS URL for more information: http:/www.sgi.com/tech/stl/stack.html #include <stack> By this point, you know that most of the STL types work the same way as the o
Wheaton College - CS - 215
AlgorithmsDESCRIPTION Today you are going to implement a binary search tree. TO DO TODAY: 1. Download the starter files for this lab from the course website: node.h node.cpp tree.h 215 Lab 06 Starter.cppLab #6 Binary Search Trees Tuesday 3/21/062. Crea
Wheaton College - CS - 215
AlgorithmsAN INTRODUCTION TO STL SORTING ALGORITHMSLab #8 Sorting in the STL Tuesday 4/04/06One of the really cool things about the Standard Template Library is the series of generic algorithms that can be used on just about any one of the STL types. E
Wheaton College - CS - 215
AlgorithmsTHE RECURRENCE RELATION T(1) = 1 T(n) = 1 + 2 T(n/2) + n EXPAND T(n) T(n) T(n) = 1 + 2 [1 + 2 T(n/22) + n/2] + n = 3 + 22 T(n/22) + 2nThe Merge-Sort Running Time Proof2 expansions= 1 + 2 + 22 [1 + 2 T(n/23) + n/4] + 2n = 7 + 23 T(n/23) + 3n
Wheaton College - CS - 215
Algorithms: SupplementProving a Lower Bound for Comparison Algorithmsn1 2 4 8 16 32 64 128log n! log(n/2)^n/2)0 1 4.58 15.30 44.25 117.66 296.00 716.16 -0.5 0 2 8 24 64 160 384log(n^n) log(n/x)^n/x)0.00 2.00 8.00 24.00 64.00 160.00 384.00 896.00 -0
Wheaton College - CS - 215
AlgorithmsAssignment #5 Program: Game Trees Phase I Due Wednesday 3/29/06 Phase II Due Friday 4/7/06OBJECTIVE In this project, you will be designing a variant of the Checkers game in which the user plays against the computer. This is a very large and in
Wheaton College - CS - 215
AlgorithmsCOMPARING THE ALGORITHMSLab #9 Pattern Matching with Different Algorithms Tuesday 4/18/06In class we have studied the algorithms and implementation of three different pattern-matching algorithms: 1. Brute Force 2. Boyer-Moore 3. Knuth-Morris-
Wheaton College - CS - 215
AlgorithmsLab #10 Standard Tries Tuesday 4/25/06In this lab, you will implement a standard trie (with a couple of small modifications) in order to store all of the words of Moby Dick and determine the list of words (each with the count of how many times
Wheaton College - CS - 325
COMP 325: Database SystemsSQL Queries due Wed. Oct 4thHomework #3Please submit this homework in electronic format in an email. It is still due at the beginning of class on the due date. PART ONE: SQL AND THE CLASS DATABASE Connect to my MySQL server th
Wheaton College - CS - 325
COMP 325: Database SystemsHandout: Locking and BlockingLOCKINGStrict Two-Phase Locking (Strict 2PL) 1. if transaction T wants to read an object, first requests a shared lock on the object; if T wants to write an object, first requests an exclusive lock
Wheaton College - CS - 325
COMP 325: Database SystemsHandout: TransactionsACID ATOMICITY either all actions in the transaction are done, or none get done nothing is left halfdone CONSISTENCY the databases consistency must be preserved by the transaction if it is runningby itse
Wheaton College - CS - 325
COMP 325:DatabaseSystemsHandout:StaticHashingIndexesStatic HashingPros: Search: 1 disk I/O (after applying hash function, fetch the bucket) Insert: 2 disk I/Os (fetch the bucket, add record, write it back out) Delete: 2 disk I/Os (fetch the bucket, del
Wheaton College - CS - 325
COMP 325: Database Systems Handout: Comparing IndexesCost of OperationsScan Heap Files Sorted Files Clustered Files Heap File, Unclustered Tree Index Heap File, Unclustered Hash IndexEquality SearchRange SearchInsert RecordDeleteComparing Files an
Wheaton College - CS - 325
COMP 325: Database SystemsHandout: Memory and DisksThe Memory HierarchyCPU CACHE MAIN MEMORY MAGNETIC DISK TAPE primary storage secondary storage tertiary storageFASTERCHEAPERWhat a Disk Looks LikeMemory and Disks Handout Page 1 of 1