Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Elementary students are on a field trip to an apple orchard in which all students will pick apples. All of the apples that are picked

Elementary students are on a field trip to an apple orchard in which all students will pick apples. All of the apples that are picked by the students will be placed together in a bin and purchased. Additionally, the teacher can choose to purchase either one or none of the following items: Apple Cider Apple Cobbler Apple Pie Students may not purchase any of these extra items . All purchases are made on the same day of the field trip. Apples 0 10: $0.50 each 11 50: $0.45 each 51 100: $0.40 each 101 150: $0.35 each 151 200: $0.30 each Extra Items One gallon of Apple Cider: $8.00 One Apple Cobbler: $15.00 One Apple Pie: $10.00 The orchard makes the Cider, Cobblers and Pies on Sunday after closing; therefore, prices are reduced as the items age. Reduction schedule Purchase on: Monday, Tuesday or Wednesday: Full price Thursday or Friday: $2.00 off Saturday or Sunday: $3.00 off There is a 7% tax added to the total purchase.

Prompt and receive input from the user for the following: Total number of apples collected by all students Day of the week that the field trip occurred Total number of students on the field trip The teachers title The teachers last name For the number of apples collected, the user should only be allowed to enter an integer between 1 and 200 inclusive. For the day of the week, the user should only be allowed to enter valid days of the week (e.g. Monday). For the total number of students on the trip, the user should only be allowed to enter an integer between 1 and 20 inclusive. For the teachers title, the user should only be allowed to enter Mr, Ms, Mrs or Dr. Do not enter punctuation as it will be added during output formatting. For the teachers last name, the user should only be allowed to enter alphabetic characters. For the day of the week, teachers title and teachers last name, the user should be allowed to enter upper or lower case. Do not validate for this. You will format this data when you use it in your output. Display a menu for the extra items that can be purchased by the teacher as follows: 1. One gallon of Apple Cider: $8.00 2. One Apple Cobbler: $15.00 3. One Apple Pie: $10.00 4. None The menu prices must be calculated. You must consider the day of the week with respect to the price reduction schedule and show the correct discounted price if appropriate. Receive the input from the user in the form of a number associated with their choice. Test the validity of the input data and use the command System.exit(0) to exit the program if invalid data is detected. No re-prompting to receive valid data is required.

Calculate the number of apples each student will receive based upon an even distribution. Every student should receive the same number of apples with any remainder being given to the teacher. If fewer apples are collected than the number of students present, then the teacher receives all of the apples. Calculate the price of the apples collected. If an extra item was ordered by the teacher (Cider, Cobbler, or Pie), calculate the price based upon the day of the week. Calculate the total price of the sale before taxes. Calculate the amount of tax based upon 7% of the total price of the sale. Calculate the total price of the sale with taxes included.

After prompting and receiving the five data items (see Input section), display how many apples each student will receive and how many apples the teacher will receive using the teachers title and name in the output text. After prompting and receiving a response for ordering an extra item, display the price structure for the apples (see Pricing Structure section), then display an itemized list that shows: 1. The number of apples collected and the price 2. If ordered, the extra item and price 3. Subtotal (if necessary) 4. The tax rate and amount of tax 5. The grand total of the sale Monetary values must be rounded to the nearest cent using standard rounding rules. For example, $3.409 will displayed as $3.41. $3.404 will displayed as $3.40. Monetary values need not be right justified for output.

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

Intelligent Databases Object Oriented Deductive Hypermedia Technologies

Authors: Kamran Parsaye, Mark Chignell, Setrag Khoshafian, Harry Wong

1st Edition

0471503452, 978-0471503453

More Books

Students also viewed these Databases questions

Question

Compare and contrast Fed funds transactions with RPs.

Answered: 1 week ago

Question

a. What is the purpose of the team?

Answered: 1 week ago

Question

b. What are its goals and objectives?

Answered: 1 week ago