You'll be creating a program that will find a donut shop at the user's provided zip-code and determine the number of drinks that the user can buy with their budget. Name your program DonutShop. java. First, your program should ask the user for their desired zip code. Using a switch statement block, you should determine what donut shop is at that zip code: ● ● 33511 is Dunkin Donuts 30328 is Tim Hortons 30356 is Krispy Kreme 30211 is Sublime If the zip code doesn't match any number, then it should print out "Sorry, no shops found." and the program will end. If there's a donut shop, you should print "There is a donut shop called [name] here!" then prompt the user for their budget (integer input). Next, using an if/else conditional block and the below cutoffs, determine the number of donuts the user will be able to purchase. ● A budget between $1 to $5 (inclusive) can purchase 2 donuts A budget between $6 to $11 (inclusive) can purchase 4 donuts A budget between $12 to $20 (inclusive) can purchase 8 donuts A budget greater than $20 can purchase 16 donuts All other budgets cannot purchase anything You should ask the user to enter the number of dollars they have, and then you should print out the number of donuts the user can purchase in the following format: "You can purchase # donut (s)." If the budget annot purchase anything print lid " Scanner is nooded for taking input from the cor can accumo

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Solution Description
You'll be creating a program that will find a donut shop at the user's provided zip-code and determine the number
of drinks that the user can buy with their budget.
Name your program DonutShop.java.
First, your program should ask the user for their desired zip code. Using a switch statement block, you should
determine what donut shop is at that zip code:
33511 is Dunkin Donuts
30328 is Tim Hortons
30356 is Krispy Kreme
30211 is Sublime
If the zip code doesn't match any number, then it should print out "Sorry, no shops found." and the
program will end.
•
●
·
If there's a donut shop, you should print "There is a donut shop called [name] here!" then
prompt the user for their budget (integer input).
Next, using an if/else conditional block and the below cutoffs, determine the number of donuts the user will be
able to purchase.
.
.
A budget between $1 to $5 (inclusive) can purchase 2 donuts
A budget between $6 to $11 (inclusive) can purchase 4 donuts
A budget between $12 to $20 (inclusive) can purchase 8 donuts
A budget greater than $20 can purchase 16 donuts
All other budgets cannot purchase anything
You should ask the user to enter the number of dollars they have, and then you should print out the number of
donuts the user can purchase in the following format: "You can purchase # donut (s)." If the budget
cannot purchase anything, print "Invalid." Scanner is needed for taking input from the user. (You can assume
the user will only enter integers for the number of dollars.) Here's what a complete run of the program should
look like. The user input is in bold.
> Welcome to Donut Shop Finder!
>
Intor you
in godo: 22511
Transcribed Image Text:Solution Description You'll be creating a program that will find a donut shop at the user's provided zip-code and determine the number of drinks that the user can buy with their budget. Name your program DonutShop.java. First, your program should ask the user for their desired zip code. Using a switch statement block, you should determine what donut shop is at that zip code: 33511 is Dunkin Donuts 30328 is Tim Hortons 30356 is Krispy Kreme 30211 is Sublime If the zip code doesn't match any number, then it should print out "Sorry, no shops found." and the program will end. • ● · If there's a donut shop, you should print "There is a donut shop called [name] here!" then prompt the user for their budget (integer input). Next, using an if/else conditional block and the below cutoffs, determine the number of donuts the user will be able to purchase. . . A budget between $1 to $5 (inclusive) can purchase 2 donuts A budget between $6 to $11 (inclusive) can purchase 4 donuts A budget between $12 to $20 (inclusive) can purchase 8 donuts A budget greater than $20 can purchase 16 donuts All other budgets cannot purchase anything You should ask the user to enter the number of dollars they have, and then you should print out the number of donuts the user can purchase in the following format: "You can purchase # donut (s)." If the budget cannot purchase anything, print "Invalid." Scanner is needed for taking input from the user. (You can assume the user will only enter integers for the number of dollars.) Here's what a complete run of the program should look like. The user input is in bold. > Welcome to Donut Shop Finder! > Intor you in godo: 22511
cannot purchase anything, print "Invalid." Scanner is needed for taking input from the user. (You can assume
the user will only enter integers for the number of dollars.) Here's what a complete run of the program should
look like. The user input is in bold.
> Welcome to Donut Shop Finder!
>
> Enter your desired zip code: 33511
> There is a donut shop called Dunkin Donuts here!
> Enter your budget: 20
> You can purchase 8 donut (s).
If there is no Donut shop:
> Welcome to Donut Shop Finder!
> Enter your desired zip code: 30310
> Sorry, no shops found.
If the budget cannot purchase anything:
> Welcome to Donut Shop Finder!
>
> Enter your desired zip code: 33511
> There is a donut shop called Dunkin Donuts here!
> Enter your budget: -1
> Invalid.
Transcribed Image Text:cannot purchase anything, print "Invalid." Scanner is needed for taking input from the user. (You can assume the user will only enter integers for the number of dollars.) Here's what a complete run of the program should look like. The user input is in bold. > Welcome to Donut Shop Finder! > > Enter your desired zip code: 33511 > There is a donut shop called Dunkin Donuts here! > Enter your budget: 20 > You can purchase 8 donut (s). If there is no Donut shop: > Welcome to Donut Shop Finder! > Enter your desired zip code: 30310 > Sorry, no shops found. If the budget cannot purchase anything: > Welcome to Donut Shop Finder! > > Enter your desired zip code: 33511 > There is a donut shop called Dunkin Donuts here! > Enter your budget: -1 > Invalid.
Expert Solution
steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Knowledge Booster
Random Class and its operations
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.
Recommended textbooks for you
Database System Concepts
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)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education