Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

During the summer months, Midway, KY, hosts Midsummer Nights in Midway. The event offers live music, shopping late at local shops, face painting, kids

image text in transcribed

During the summer months, Midway, KY, hosts Midsummer Nights in Midway. The event offers live music, shopping late at local shops, face painting, kids activities, and food vendors. One vendor sells. kettle popcorn ($4.50 a bag) and soft drinks ($1.00 each) on a cash-only basis. Develop a Java application that will print (display) receipts for popcorn vendor (to give to customers). Since this is a monetary application and we want to be accurate with our calculations, use integers for all monetary values (representing the values in terms of pennies) until the final answer is calculated at which time you can divide by 100 to get the correct floating-point value. For example, $4.50 would be 450 pennies. Input: Using the Scanner class, the application should input the following: date of purchase o In format mmddyyyy - for example: 09172016) * * o Make sure you do not input month, day and year separately buyer's first name buyer's last name the number of bags of popcorn purchased the number of soft drinks purchased a street vendor's ID (any 5 characters) * Create any constants you may need for this program. * Items that contain all digits are not necessarily numeric values. You should declare a data item (variable or constant) as an integer or floating-point value ONLY IF it is reasonable to use that data item in a mathematical calculation. For example, zipcodes are all numeric in the U.S. but we never use them in calculations. We do not total zipcodes, we do not calculate averages of zipcodes, etc. A zipcode should be declared as a String. The same would be true for social security numbers, dates, phone numbers, credit card numbers, student IDs, vendor IDs, etc. HINT: If you attempt to read a String (nextLine() method) after reading a number (nextByte(), nextInt(), nextFloat(), or nextDouble() methods), you will first need to: Write a nextLine() method to clear the input buffer (this reads the enter from the previously read number Write another nextLine() to read the actual String you want Processing Generate a 4-digit random number in the range 1000-4999. Make sure 1000 and 4999 are included in the range of numbers that could be generated. Using String methods and concatenation, build a confirmation "number" for the buyer and store it in a String variable. It should include: the string POPCORN followed by the character #, followed by the buyer's last name, followed by the character #, followed by the first initial of the buyer's first name (use the substring() method), followed

Step by Step Solution

3.42 Rating (161 Votes )

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

Introduction to Management Science

Authors: Bernard W. Taylor

12th edition

133778843, 978-0133778847

More Books

Students also viewed these Programming questions

Question

What are the strengths and weaknesses of arguments by analogy?

Answered: 1 week ago

Question

Using a graphing utility, graph y = cot -1 x.

Answered: 1 week ago