blem: Meal gift card. Your favorite campus restaurant sells meals for $13 each meal. The restaurant requires members to pre-pay any amount of money they wish, and then purchase as many meals accordingly. You are required to write a java program correctly that would ask the user for the amount that they will pay, then display a message indicating how many meals that user will be able to purchase as well as how much funds will remain in the gift card after that.  Using exactly 1 integer constant, 3 integer variables, and 1 Scanner variable make sure to fulfill the following points: 1. Declare the following constant integer: PRICE and set it to 13. 2. Declare 3 unassigned integer variables amount, meals, balance. 3. Declare 1 Scanner variable that will record keyboard inputs. 4. Prompt the user in the console for the amount that they will pay and assign to amount (use same format and wording as in the sample outputs below). Assume the user will enter an integer value. 5. Assign to meals the result of amount / PRICE. 6. Assign to balance the result of amount % PRICE. 7. Output to the console a blank line followed by the message With $ you can buy meals and will have a balance of $. Where ,and are the values stored in the corresponding variables.  Based on the previous specifications your program should look and behave exactly as displayed in the cases below. Your program should work for any double values entered by the user, not just the ones in the sample. Note that ◦ symbol indicates a space and ↵ is a new line character. All words except for user input (in blue) must be exactly as indicated in the sample. Any extra “spaces” and/or “new lines” will be graded a wrong answer. Note 1: You are to expect a perfect user who always enters integer numbers., do not verify the validity of user input. Note 2: The use of libraries other than java.util.Scanner is prohibited. Your program must work for any integer values entered, not just the ones in the samples above. Note 3: Final thought, remember that your solution is space-sensitive and fulfill the above instructions carefully and precisely.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Problem: Meal gift card. Your favorite campus restaurant sells meals for $13 each meal. The restaurant requires members to pre-pay any amount of money they wish, and then purchase as many meals accordingly. You are required to write a java program correctly that would ask the user for the amount that they will pay, then display a message indicating how many meals that user will be able to purchase as well as how much funds will remain in the gift card after that. 

Using exactly 1 integer constant, 3 integer variables, and 1 Scanner variable make sure to fulfill the following points:

1. Declare the following constant integer: PRICE and set it to 13.

2. Declare 3 unassigned integer variables amount, meals, balance.

3. Declare 1 Scanner variable that will record keyboard inputs.

4. Prompt the user in the console for the amount that they will pay and assign to amount (use same format and wording as in the sample outputs below). Assume the user will enter an integer value.

5. Assign to meals the result of amount / PRICE.

6. Assign to balance the result of amount % PRICE.

7. Output to the console a blank line followed by the message

With $ you can buy meals and will have a balance of $.

Where ,and are the values stored in the corresponding variables. 

Based on the previous specifications your program should look and behave exactly as displayed in the cases below. Your
program should work for any double values entered by the user, not just the ones in the sample.
Note that ◦ symbol indicates a space and ↵ is a new line character. All words except for user input (in blue) must be exactly as indicated in the sample. Any extra “spaces” and/or “new lines” will be graded a wrong answer.

Note 1: You are to expect a perfect user who always enters integer numbers., do not verify the validity of user input.
Note 2: The use of libraries other than java.util.Scanner is prohibited. Your program must work for any integer values entered, not just the ones in the samples above.
Note 3: Final thought, remember that your solution is space-sensitive and fulfill the above instructions carefully and
precisely.

 

Program Sample outputs
Amount°you°wish•to°prepay:°$844
With $84°you°can•buy°6 meals and•will have°a•balance°of°$6.
Amount°you®wish to°prepay:°$1954
With $195°you°can•buy°15°meals and•will•have°a•balance°of°$0.
Transcribed Image Text:Program Sample outputs Amount°you°wish•to°prepay:°$844 With $84°you°can•buy°6 meals and•will have°a•balance°of°$6. Amount°you®wish to°prepay:°$1954 With $195°you°can•buy°15°meals and•will•have°a•balance°of°$0.
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY