Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA Programming Scenario Description Elementary students are on a field trip to an apple orchard in which all students will pick apples. All of the

image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
JAVA Programming Scenario Description 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. Pricing Structure 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. Program Requirements Input 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 teacher's title The teacher's 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 teacher's 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 teacher's last name, the user should only be allowed to enter alphabetic characters. For the day of the week, teacher's title and teacher's 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. Processing 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. Output 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 teacher's 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. Program Execution Your program execution should appear as follows, using this wording and formatting. Any divergence from the program execution flow or verbiage shown below must be logical and aesthetically pleasing. The input and output values (eg. number of apples collected) are for illustration purposes only. I will test your program based upon several sets of values. Please enter the following Total number of apples collected by all students: 102 Day of the week that the field trip occurred (Monday, Tuesday, etc.): Thursday Total number of students on the field trip: 10 Teacher's title: Mrs Teacher's last name: Smith Mrs. Smith, each student will receive 10 apples with 2 apples left over for you. Mrs. Smith, prices for the following items are reduced by $2.00 today, Thursday. Would you like to purchase ONE extra item from the following menu? 1. One gallon of Apple Cider: $6.00 2. One Apple Cobbler: $13.00 3. One Apple Pie: $8.00 4. None Your Choice: 2 Sale Summary Apple Prices 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 102 Apples collected at $0.35 each: One Apple Cobbler: Subtotal: 7% tax: Grand Total: $35.70 $13.00 $48.70 $3.41 $52.11 JAVA Programming Scenario Description 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. Pricing Structure 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. Program Requirements Input 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 teacher's title The teacher's 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 teacher's 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 teacher's last name, the user should only be allowed to enter alphabetic characters. For the day of the week, teacher's title and teacher's 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. Processing 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. Output 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 teacher's 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. Program Execution Your program execution should appear as follows, using this wording and formatting. Any divergence from the program execution flow or verbiage shown below must be logical and aesthetically pleasing. The input and output values (eg. number of apples collected) are for illustration purposes only. I will test your program based upon several sets of values. Please enter the following Total number of apples collected by all students: 102 Day of the week that the field trip occurred (Monday, Tuesday, etc.): Thursday Total number of students on the field trip: 10 Teacher's title: Mrs Teacher's last name: Smith Mrs. Smith, each student will receive 10 apples with 2 apples left over for you. Mrs. Smith, prices for the following items are reduced by $2.00 today, Thursday. Would you like to purchase ONE extra item from the following menu? 1. One gallon of Apple Cider: $6.00 2. One Apple Cobbler: $13.00 3. One Apple Pie: $8.00 4. None Your Choice: 2 Sale Summary Apple Prices 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 102 Apples collected at $0.35 each: One Apple Cobbler: Subtotal: 7% tax: Grand Total: $35.70 $13.00 $48.70 $3.41 $52.11

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions