subject

There are two prompts below. for the first prompt, you will be implementing a stack and for the secondprompt you will be implementing a queue. you will be creating functions only.0 points if you do not do the following: 1. you must implement one prompt using an array (using a struct-refer to classcode) and the other using alinked list.2. all functions dealing with operations on the stack and queue (like push, pop, enqueue, is_full etc) shouldbe kept in the stack_queue7 files. these operations should be called in your functions created below. feelfree to modify operation functions given in class or create your own.3. all functions created for the prompts (four below) should be kept in the hw7 files. prompt 1 (40 points): jameel works at a restaurant where all servers put their tips into a tip jar for the night. at the end of thenight, each server gets two dollars for each hour they worked. a) function 1: create a function that allows users (servers in this case) to continuously enter tips made until eitherthe stack is at full capacity or the word done is entered (meaning the night is over). the tip jar shouldbe implemented as a stack. choose any parameters and return values you find necessary. a possible function run might look like: ***tip jar***enter tip: $15.95enter tip: $5.00enter tip: $10.50enter tip: doneb) function 2create a function that calculates the amount the user makes. choose any parameters and return values……you find necessary. a possible function run might look like: hello, how many hours did you work? 6ok, giving you $12.***tip jar (updated)***enter tip: $15.95enter tip: $3.50 /*notice the leftover money is put back in the tip jar*/prompt 2 (40 points): natalya works at an airline counter. all the customers she deals with for the day are kept in a file in theformat first name, last name, flight number (for example: jon, doe,3434). you may find it useful to create asample file to test your program. the list of all customers and their corresponding flight numbers shouldbe implemented as a queue. a) function 3create a function that reads in file info into a queue (assume that the number of lines in the file is….always less than the capacity of the queue). the first and last name should be held in a pointer called….full_name and the flight number should be held as an int. choose any parameters and return values you….find necessary. a possible function run might look like: --adding in customer info from file: jon doe – 3434jane doe – 3434bob doe – 8934bill doe – 1234don doe – 9393frank doe – 1234all customer info added. b) function 4create a function that allows the user to check which customers are taking a specific flight (the flight… you are checking should be a parameter to the function). the customers taking this flight……should be printed to screen and placed into a file (see below). choose any additional parameters and……return values you find necessary. a possible function run might look like: --passengers for 1234: bill doe is taking flight 1234. /*notice bill doe is handled first since we are dealing with a queue*/frank doe is taking flight 1234.(the output file should contain the same information printed to screen).do not forget to indent (10 points) and includecomments (10 points).

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 06:30
Selective incapacitation is a strategy to reduce prison population
Answers: 3
question
Computers and Technology, 22.06.2019 13:10
Calculating the "total price" of an item is tedious, so implement a get_item_cost method that just returns the quantity times the price for an item. by the way, the technical term for this kind of instance method is an accessor method, but you'll hear developers calling them getters because they always start with "get" and they get some value from instance attributes. in order to make the items sortable by their total total price, we need to customize our class. search the lectures slides for "magic" to see how to do this. see section 9.8 for an additional reference. the receipt class: this will be the class that defines our receipt type. obviously, a receipt will consist of the items on the receipt. this is called the composition design pattern. and it is very powerful. instance attributes: customer_name : it is very important to always know everything you can about your customers for "analytics", so you will keep track of a string customer name in objects of type receipt. date : the legal team has required that you keep track of the dates that purchases happen for "legal reasons", so you will also keep track of the string date in objects of type receipt. cart_items : this will be a list of the items in the cart and hence end up on the receipt. methods: 1. create a default constructor that can take a customer name as an argument, but if it gets no customer name, it will just put "real human" for the customer_name attribute. it should also accept a date argument, but will just use the value "today" for the date instance attribute if no date is given. the parameters should be named the same as the instance attributes to keep things simple. 2. add_item : self-descriptive. takes a parameter which we hope beyond hope is of type itemtopurchase and adds it to the cart_items. returns none. 3. print_receipt : takes a single parameter isevil, with default value true. returns a total cost of all the items on the receipt (remember to factor in the quantity). prints the receipt based on the following specification: for example, if isevil is true, and customer_name and date are the default values: welcome to evilmart, real human today have an evil day! otherwise, it should print: welcome to goodgo, real human today have an good day! then the receipt should be printed in sorted order like we discussed earlier, but whether or not it starts with the highest cost (think reverse), depends on the value of isevil. if it is evil, then the lowest cost items should print first, but if it is good, then it will print the highest cost items first. (cost meaning price*quantity). remember to return the total cost regardless! your main() function: the main flow of control of your program should go in a main() function or the program will fail all the unit tests. get the name of the customer with the prompt: enter customer name: get the date with the prompt: enter today's date then, ask the question: are you evil? your program should consider the following as true: yeah yup let's face it: yes hint: what do these strings all have in common? your program should consider all the following as false: no nah perhaps but i'm leaning no (just be glad you don't have to handle "yeah no.") okay enough horsing around. (get it? aggies? ! horsing! ) next, in the main() function, you will have to create a receipt object and start adding things into it using an input-while loop. the loop will prompt the user for the item name exactly as in the previous zylab (9.11). but unlike the previous zylab, the loop will terminate only if an empty string is entered for the item name. then, the price and the quantity will be prompted for exactly as in the previous zylab. create the itemtopurchase objects in the same manner as the previous zylab, but don't forget to add them to the receipt using your add_item instance method. then, the items on the receipt should be printed with the same formatting as in the previous zylab, of course with either "good" or "evil" ordering. however, on the last line, the total should be printed as follows: where 10 is replaced by the actual total. sample run here is what a sample run of the final program should look like: enter customer name: nate enter today's date: 12/20/2019 are you evil? bwahahahaha yes enter the item name: bottled student tears enter the item price: 2 enter the item quantity: 299 enter the item name: salt enter the item price: 2 enter the item quantity: 1 enter the item name: welcome to evilmart, nate 12/20/2019 have an evil day! salt 1 @ $2 = $2 bottled student tears 299 @ $2 = $598 total: $600
Answers: 1
question
Computers and Technology, 23.06.2019 18:00
File account.java (see previous exercise) contains a definition for a simple bank account class with methods to withdraw, deposit, get the balance and account number, and return a string representation. note that the constructor for this class creates a random account number. save this class to your directory and study it to see how it works. then write the following additional code: 1. suppose the bank wants to keep track of how many accounts exist. a. declare a private static integer variable numaccounts to hold this value. like all instance and static variables, it will be initialized (to 0, since it’s an int) automatically. b. add code to the constructor to increment this variable every time an account is created. c. add a static method getnumaccounts that returns the total number of accounts. think about why this method should be static - its information is not related to any particular account. d. file testaccounts1.java contains a simple program that creates the specified number of bank accounts then uses the getnumaccounts method to find how many accounts were created. save it to your directory, then use it to test your modified account class.
Answers: 3
question
Computers and Technology, 24.06.2019 01:00
Mastercard managers are motivated to increase (1) the number of individuals who have and use a mastercard credit card, (2) the number of banks and other clents who issue mastercards to customers and/or employees, and (3) the number of locations that accept mastercard payments. discuss how mastercard could use its data warehouse to it expand each of these customer bases.
Answers: 3
You know the right answer?
There are two prompts below. for the first prompt, you will be implementing a stack and for the seco...
Questions
question
Social Studies, 02.12.2019 07:31
question
Computers and Technology, 02.12.2019 07:31
question
Mathematics, 02.12.2019 07:31