Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
**USE PYTHON**
Suppose a machine sells bottles of Coca-Cola (Coke) for 50 cents and only accepts coins in these denominations: 25 cents, 10 cents, and 5 cents.
In a file called coke.py, implement a program that prompts the user to insert a coin, one at a time, each time informing the user of the amount due. Once the user has inputted at least 50 cents, output how many cents in change, the user is owed. Assume that the user will only input integers, and ignore any integer that isn’t an accepted denomination.
***PLEASE SEE ATTACHED IMAGE **
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 2 steps
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question
What is the Error 404. If you cannot do it,please reject it!
Solution
by Bartleby Expert
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question
What is the Error 404. If you cannot do it,please reject it!
Solution
by Bartleby Expert
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- A photographer is organizing a photo collection about the national parks in the US and would like to annotate the information about each of the photos into a separate set of files. Write a program that reads the name of a text file containing a list of photo file names. The program then reads the photo file names from the text file, replaces the "_photo.jpg" portion of the file names with "_info.txt", and outputs the modified file names. Assume the unchanged portion of the photo file names contains only letters and numbers, and the text file stores one photo file name per line. If the text file is empty, the program produces no output. Ex: If the input of the program is: ParkPhotos.txtand the contents of ParkPhotos.txt are:…arrow_forwardThis is for Python Programing version 3.8.5 - Need a program that uses a text file to store weekly payroll data for the office. The program should enable the user to enter the name, hourly pay rate, and weekly hours for a number of office employees. The pay rate and hours should be type float, and each datum should be written to its own line in the file. Enter data for at least five employees and then close the file. Please include Pseudocode and def main () function.arrow_forwardHi, i need help with this program using Java. Write a program that reads the file AdventuresInWonderland.txt one line at a time and prints the count of each of the five vowels followed by a count of the consonants in the file. Coding requirements: Read the text from the file AdventuresInWonderland.txt. Use a single while loop to read the lines of the file. Use a single for loop to iterate over the characters in each line. Use a single switch statement to determine which counter to increment. Notes: The input may contain punctuation and digits as well as letters. Account for both uppercase and lowercase letters. Character.toLowerCase(ch) returns the lowercase character corresponding to ch(char ch). Character.toUpperCase(ch) returns the uppercase character corresponding to ch(char ch). Character.isLetter(ch) returns true when ch is an alphabetic letter Expected output: Vowels found: a: 324 e: 455 i: 251 o: 300 u: 109 Consonants: 2384 Example: If one creates a Scanner as…arrow_forward
- Python PLEASEEEEEEEE.arrow_forwardCan you help me write a C++ Program that does the following: Create a program that reads a file containing a list of songs andprints the songs to the screen one at a time. After each song is printed,except for the last song, the program asks the user to press enter for more.After the last song, the program should say that this was the last song andquit. If there were no songs in the file to begin with, the program shouldsay that there are no songs to show and quit.The program should begin by asking the user for the name of the input file.Each song consists of a title, artist and year.In the file, each song is given on three consecutive lines.Create this program using the latest version of the class Song you created. The latest version of the class song I created is below: #include <iostream>#include <string>using namespace std;class Song {private: string Title; string Artist; int Year;public: Song() : Title("invalid"), Artist("invalid"), Year(-1) {} Song(const string…arrow_forwardThis is for Python version 3.8.5 and please include pseudocode. A file named gang.txt is shown below. Write Python code that opens this file, reads only the first two lines, and prints “Penny is 19” gang.txt (contents of file) - please create on with the data provided in order to complete this question. Thank you! Penny 19 Kenny 20 Benny 21 Jenny 20arrow_forward
- The local t-shirt shop sells shirts that retail for $14.99. Quantity discounts are given as follow: Number of Shirts Discount < 10 0% 11-20 10% 21-50 15% 51 or more 20% Write a program that can run within a .cpp file that prompts the user for the number of shirts required and then computes the total price. Output the cost per shirt, discount percentage, and total cost. Make sure the program accepts only nonnegative input. You must use a constant to represent price of the shirt You must use the correct data types for your constants and variables You must validate your input. Do not allow negative number of shirts. This should display a warning You must use one or more if/else branches for your decisions You must also use a logical operator at least once to check the ranges. Your output should be formatted correctly Prices should have two decimal places Percents should have one decimal place Sample Run: How many shirts would you like?25 The cost per…arrow_forward**** In Java Please **** Task : Please write a program or a code to calculate the frequency percentage of the occurrences of the characters in a text file.arrow_forwardcan you do it pythonarrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education