Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Lab 3: Decisions COSC 1336 Programming Fundamentals I Kathryn Rehfield Lab 3: Decisions Due: 06/16/17 Last day accepted for half credit: 06/20/17 You will add

Lab 3: Decisions COSC 1336 Programming Fundamentals I Kathryn Rehfield Lab 3: Decisions Due: 06/16/17 Last day accepted for half credit: 06/20/17 You will add to your Lame Game computer gaming program from Lab 2. Be sure to update your header comments and the program description that is displayed for the user. You will remove all the code that asks the users name and displays the personal message. You will not ask the user their name. You will not display which option they chose. Your menu will still have the following options: 1. Make Change 2. High Card 3. Quit Your program will display the menu, prompt for and read the users option. Then your program will branch based on the option: If the user chooses option 1, play the make_change game If the user chooses option 2, display the message High Card is coming soon. If the user chooses option 3, you do nothing - your program should just end naturally. Do not display "Bye" or any other message. If you do not do anything for a particular condition, just don't check for it. If the user chooses an invalid option (option < 1 or option > 3) your program should display the message Invalid option and terminate naturally. Do not try to re-prompt for input. The make_change game does the following: Allow a clerk to enter the amount of money a customer owes for a purchase and the amount of money the customer paid. This function should calculate and display the amount of change. Then break it down into the number of dollars, quarters, dimes, nickels and pennies to return to the customer. For example: If the amount owed is $3.16 and the amount paid is $20, you program should display the change due as: $16.84 16 dollars 3 quarters 1 nickel 4 pennies If the amount owed is $2.33 and the amount paid is $5, you program should display the change due as: $2.67 2 dollars 2 quarters 1 dime 1 nickel 2 pennies You decide exactly how to display the change, but your output should include all the information above. Display the total amount of change due to two decimal places consistent with money amounts. The number of each denomination to be paid back to the customer will be integers. Display an appropriate message when the amount paid is less than the amount owed, do not try to ask for additional money, just display the message. Be sure to test: amount owed: .91 amount paid: 1.00 You will submit the following in Blackboard: 8. Your typed algorithm - "lab3_algrithm_FirstName_LastName" (do not put the quotes as part of the file name.) 9. Your program source code - Not a copy pasted into a word processing document. It should be named lab3_FirstName_Lastname.py NOTE Once your lab grade has been posted in Blackboard, you will have access a copy of my solution attached to your grade. Lab Grade Points 10. Algorithm 30 points 11. Comments 15 points a. program description b. major algorithm steps c. function descriptions (starting w/ Lab 5) 12. Followed directions 15 points 13. Correct output 15 points 14. Structured program design 20 points 15. Meaningful identifier names 5 points ********* THESE ARE JUST EXAMPLES TO SHOW YOU WANT I AM EXPECTING ********* Program descriptions should look similar to this: ##################################################### # Clovis Bagwell # # Lab 1 # # This program prompts the user for a positive integer # # and displays a message whether it is prime or not. # # The program will continue to prompt for an integer # # and display a message until the user enters a sentinel # # value of 0. # #################################################### Lab 4: Repetition COSC 1336 Programming Fundamentals I Kathryn Rehfield Lab 4: Repetition Due: 06/27/17 Last day accepted for half credit: 06/30/17 Add to lab 3: Lame Game Computer Game Room. Be sure to update the part of your program that describes to the user what the program will do. Make any necessary updates to your make_change game. You will have a loop in your program to control displaying the menu and playing the games. Continue to re-display the menu, read a menu option and play a game until the user enters option 3 (quit). You will now implement the High Card game. You will write a code to randomly generate two playing cards using the following rules: 1 = ace 2 10 = number cards 11 = jack 12 = queen 13 = king Your high_card game will ask for the first name of each player to be used when displaying the results. For purposes of this game, Ace is the lowest card. This game will deal two cards, one to each of the two players, and display the face value of player ones card and player twos card. The game will then display which player got the highest card or if it is a tie. When the High Card game is played, the output should look similar to this: Enter player 1s name: Slydelle Enter player 2s name: Kimminy Slydelle got a Seven Kimminy got a King Kimminy is the winner You will simulate dealing a card by generating a random number between 1 and 13. To use the random number generating function randint, you will need to import the module containing the code for the function. Put this line at the top of your file just under your program header comment block: import random To deal a card you will use the following statement: card1 = random.randint(1, 13) card2 = random.randint(1, 13) You can read more about the function in chapter 5 on pages 197-198. Your program will display the face value of each playing card. The decision will be based on the numeric value of the card and will display the face value using the following rules: 1 display Ace 2 thru 10 display Two, Three, etc. 11 display Jack 12 display Queen 13 display King You will now use an input validation loop to ensure the users choice is valid. If the user enters an invalid option, display an error message, and re-prompt for users choice. You will submit the following in Blackboard: Your program source code - Not a copy pasted into a word processing document named lab4_Firstname_Lastname.py NOTE Violating any of the following is grounds for getting a ZERO on your lab: 1. You will NEVER call main() more than once. 2. You will NEVER use pass, continue, break, exit, quit, end or ANYTHING to leave a loop, function, or other construct prematurely. 3. You will NEVER have a function call itself. 4. You will NEVER use global variables. However, you may use global constants if used properly. 5. You will have only one return statement in a function. NOTE Once your lab grade has been posted in Blackboard, you will have access a copy of my solution attached to your grade. Lab Grade Points 6. Algorithm 30 points 7. Comments 15 points a. program description b. major algorithm steps c. function descriptions (starting w/ Lab 5) 8. Followed directions 15 points 9. Correct output 15 points 10. Structured program design 20 points 11. Meaningful identifier names 5 points Program descriptions should look similar to this:

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Basics Computer EngineeringInformation Warehouse Basics From Science

Authors: Odiljon Jakbarov ,Anvarkhan Majidov

1st Edition

620675183X, 978-6206751830

More Books

Students also viewed these Databases questions

Question

18. If you have power, then people will dislike and fear you.

Answered: 1 week ago