In this assignment you will be generating an informative invoice for the AM Coffee shop where...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
In this assignment you will be generating an informative invoice for the AM Coffee shop where the tax is dependent on the date of the month the order is placed. Here's what your program will do: Print a greeting "Welcome to AM Coffee Shop" Print the company logo "AM" in large letters spanning at least 6 lines Ask the user for the day of the month (an integer between 1 and 31 - for simplicity we will assume all months are 31 days long) Assume user enters valid data. Ask the user for the quantity of coffee in pounds. Assume user can enter a fractional value (See the sample runs below). Read both the values and show a table showing costs (cost of coffee, shipping cost, tax amount and total cost) for three days: today, tomorrow and the day- after based on the following policy. . Coffee shop charges $9.50 per pound Shipping charges are $0.65 per pound + $2.50 fixed cost for overhead Tax rate is variable depending on the day of the month. Tax percentage is number of days remaining in the month (assuming all months are 31 days long) divided by 5. e.g. on the 5th day of the month, the tax rate is (31-5)/5 = 5.2 %. Tax is applied only to the cost of coffee Print all the quantities rounded to maximum of 2 decimal places. . (Note that because floating number representation is not precise, your calculations may result in numbers that are different from the sample runs by a couple of cents.) Sample runs: Sample run with class constant COL_WIDTH set to 10: ---jGRASP exec: java CoffeeShopInvoice Welcome to AM Coffee shop AM /------\ *** 1 Enter the date: 3 Enter the pounds of coffee: 25.5 ** Shipping Cost: $19.08 Cost of coffee: $242.25 Date L 3 $13.57 4 === Tax 5 $13.08 ** $12.6 **** Total $274.9 $274.41 $273.93 ----jGRASP: operation complete. Sample run with class constant COL_WIDTH set to 15: Welcome to AM Coffee shop AM *** Enter the date: 8 Enter the pounds of coffee: 120.5 -jGRASP exec: java CoffeeshopInvoice ****** Shipping Cost: $80.83 Cost of coffee: $1144.75 ****** *******: ======= ======== ======== Date ==== ===== L 8 9 10 ******** $52.66 $50.37 ==== ====== =============== Tax $48.08 -jGRASP: operation complete. == ********* == ******: ********* *********** Total ==== $1278.24 ==== $1275.95 ====== $1273.66 =========== You will write a complete class called CoffeeShopInvoice in a file called Coffee ShopInvoice.java and upload the file. This class should have the following: 1. COL_WIDTH: a class constant that defines the width of the columns of the invoice being printed. You should use this constant all through the code so that changing this value and re-compiling and running the program will change the width of the columns keeping proper alignment of the table headers and numbers. Initialize it to 15. 2. padString method that accepts two parameters: a String and an integer representing a length. The method should pad the parameter string with spaces until its length is the given length and return the padded string. For example, padstring ("hello", 8) should return " hello". If the string's length is already at least as long as the length parameter, your method should return the original string. (Same as BJP Exercise 3.17) 3. printLogo method that takes no parameters and prints the logo of the coffee shop as shown in the sample runs above. Use the COL_WIDTH class constant to print the correct size separator lines. The width of the letters 'AM' of the logo will stay the same irrespective of the value of COL_WIDTH class constant. You don't have to use any for-loops in printing the logo. Just come up with a way to print the letters spanning at least 6 lines. 4. round To2Decimal method that accepts a double parameter and returns that number rounded to two decimal places. Hint: Math.round() method can be helpful here. 5. 6. calculate CostOfCoffee method that accepts the number of pounds ordered and returns the cost of coffee rounded to 2 decimal places. calculateShipping Cost method that accepts the number of pounds ordered and returns the shipping cost rounded to 2 decimal places. 7. calculateTax method that accepts the date and cost of coffee as parameters. It calculates the tax rate, applies it to the cost of coffee and returns the tax amount rounded to 2 decimal places. 8. printInvoice method that accepts two parameters: the date as an integer and the number of pounds as a double. This method will use other helper methods described above to calculate the different amounts to be printed in the invoice for the three days: today, tomorrow and the day after. It prints the shipping cost and the cost of coffee. The tax rate changes every day as described above. This method print the date, tax amount and the total (cost of coffee, tax and shipping cost) for that date in a tabular form as shown above. Use the COL_WIDTH class constant, padString methods to get the column headers and the numbers right- aligned and formatted in a tabular form as shown in the sample runs. 9. main method that prompts the user to enter the date and the number of pounds and calls other methods to get the logo and the invoice table printed. 10. Ensure your program output matches the format shown in the sample runs. 11. Requirements: 1. If the value of COL_WIDTH is changed and the program is re-compiled and re-run, the tables should maintain the alignment of separator line, headers and numbers. 2. It is not enough that your program produces required output, your program should write and use helper methods as described above. The methods should be declared with correct parameter(s) and return type. In this assignment you will be generating an informative invoice for the AM Coffee shop where the tax is dependent on the date of the month the order is placed. Here's what your program will do: Print a greeting "Welcome to AM Coffee Shop" Print the company logo "AM" in large letters spanning at least 6 lines Ask the user for the day of the month (an integer between 1 and 31 - for simplicity we will assume all months are 31 days long) Assume user enters valid data. Ask the user for the quantity of coffee in pounds. Assume user can enter a fractional value (See the sample runs below). Read both the values and show a table showing costs (cost of coffee, shipping cost, tax amount and total cost) for three days: today, tomorrow and the day- after based on the following policy. . Coffee shop charges $9.50 per pound Shipping charges are $0.65 per pound + $2.50 fixed cost for overhead Tax rate is variable depending on the day of the month. Tax percentage is number of days remaining in the month (assuming all months are 31 days long) divided by 5. e.g. on the 5th day of the month, the tax rate is (31-5)/5 = 5.2 %. Tax is applied only to the cost of coffee Print all the quantities rounded to maximum of 2 decimal places. . (Note that because floating number representation is not precise, your calculations may result in numbers that are different from the sample runs by a couple of cents.) Sample runs: Sample run with class constant COL_WIDTH set to 10: ---jGRASP exec: java CoffeeShopInvoice Welcome to AM Coffee shop AM /------\ *** 1 Enter the date: 3 Enter the pounds of coffee: 25.5 ** Shipping Cost: $19.08 Cost of coffee: $242.25 Date L 3 $13.57 4 === Tax 5 $13.08 ** $12.6 **** Total $274.9 $274.41 $273.93 ----jGRASP: operation complete. Sample run with class constant COL_WIDTH set to 15: Welcome to AM Coffee shop AM *** Enter the date: 8 Enter the pounds of coffee: 120.5 -jGRASP exec: java CoffeeshopInvoice ****** Shipping Cost: $80.83 Cost of coffee: $1144.75 ****** *******: ======= ======== ======== Date ==== ===== L 8 9 10 ******** $52.66 $50.37 ==== ====== =============== Tax $48.08 -jGRASP: operation complete. == ********* == ******: ********* *********** Total ==== $1278.24 ==== $1275.95 ====== $1273.66 =========== You will write a complete class called CoffeeShopInvoice in a file called Coffee ShopInvoice.java and upload the file. This class should have the following: 1. COL_WIDTH: a class constant that defines the width of the columns of the invoice being printed. You should use this constant all through the code so that changing this value and re-compiling and running the program will change the width of the columns keeping proper alignment of the table headers and numbers. Initialize it to 15. 2. padString method that accepts two parameters: a String and an integer representing a length. The method should pad the parameter string with spaces until its length is the given length and return the padded string. For example, padstring ("hello", 8) should return " hello". If the string's length is already at least as long as the length parameter, your method should return the original string. (Same as BJP Exercise 3.17) 3. printLogo method that takes no parameters and prints the logo of the coffee shop as shown in the sample runs above. Use the COL_WIDTH class constant to print the correct size separator lines. The width of the letters 'AM' of the logo will stay the same irrespective of the value of COL_WIDTH class constant. You don't have to use any for-loops in printing the logo. Just come up with a way to print the letters spanning at least 6 lines. 4. round To2Decimal method that accepts a double parameter and returns that number rounded to two decimal places. Hint: Math.round() method can be helpful here. 5. 6. calculate CostOfCoffee method that accepts the number of pounds ordered and returns the cost of coffee rounded to 2 decimal places. calculateShipping Cost method that accepts the number of pounds ordered and returns the shipping cost rounded to 2 decimal places. 7. calculateTax method that accepts the date and cost of coffee as parameters. It calculates the tax rate, applies it to the cost of coffee and returns the tax amount rounded to 2 decimal places. 8. printInvoice method that accepts two parameters: the date as an integer and the number of pounds as a double. This method will use other helper methods described above to calculate the different amounts to be printed in the invoice for the three days: today, tomorrow and the day after. It prints the shipping cost and the cost of coffee. The tax rate changes every day as described above. This method print the date, tax amount and the total (cost of coffee, tax and shipping cost) for that date in a tabular form as shown above. Use the COL_WIDTH class constant, padString methods to get the column headers and the numbers right- aligned and formatted in a tabular form as shown in the sample runs. 9. main method that prompts the user to enter the date and the number of pounds and calls other methods to get the logo and the invoice table printed. 10. Ensure your program output matches the format shown in the sample runs. 11. Requirements: 1. If the value of COL_WIDTH is changed and the program is re-compiled and re-run, the tables should maintain the alignment of separator line, headers and numbers. 2. It is not enough that your program produces required output, your program should write and use helper methods as described above. The methods should be declared with correct parameter(s) and return type.
Expert Answer:
Answer rating: 100% (QA)
Lets break our solution into three portions starting with the logic of logo Its tricky if you trying to code it with loop but thats not necessary so S... View the full answer
Related Book For
Modern Database Management
ISBN: 978-0133544619
12th edition
Authors: Jeff Hoffer, Ramesh Venkataraman, Heikki Topi
Posted Date:
Students also viewed these programming questions
-
Gallup Enterprises out of Gallup, New Mexico, is in the business of producing and then selling sand paintings to tourists. Gallup Enterprises is planning operations for the next year which is...
-
gement 1 / 1 200% +1 2-77. Specify the magnitude F3 and directions a3, B3, and y3 of F3 so that the resultant force of the three forces is FR = (9 j} kN. 2-79. Determine the magnitude and coordinate...
-
Assume that after getting your Bachelor's degree in Higher College of Technology you wanted to pursue your Master's degree which University of Stanford is offering the program for 3 years. And you...
-
Assume that global lightning on the Earth constitutes a constant current of 1.00 kA between the ground and an atmospheric layer at potential 260 kV. (a) Find the power of terrestrial lightning. (b)...
-
Since about 1980, GDP per capita (that is, the average real income per person) in the United States has risen fairly substantially. Yet real wages have failed to rise. What do you think may explain...
-
a. Find the range for the data in Exercise 3.41. b. Which is a better measure of variability to report, the range or the interquartile range? Why? Data from problem exercise 3.41 Find the median and...
-
Independence. You audited Ruiz Rug Company's opening balance sheet and rendered an unqualified opinion on it. A month after rendering your report you are offered the position of secretary of the...
-
On July 1, 2014, Visnak Satellites issued $4,500,000, 7%, 10-year bonds at $4,194,218. This price resulted in an effective-interest rate of 8% on the bonds. Visnak uses the effective interest method...
-
Use the formula for S, to find the sum of the first five terms of the geometric sequence. 6, - 3, 2 4 " The sum of the first five terms is (Simplify your answer. Type an integer or a fraction.)
-
It is now January 2018. The year 2017 finished well. The finalized year-end financial statements for 2017 are provided in the excel file associated with this assignment. Randolf and Tenisa at Comfy...
-
Selected transactions for Ayayai Corp. during its first month in business are presented below. Sept. 1 Issued common stock in exchange for $18,000 cash received from investors. 5 Purchased equipment...
-
1.is it right that the American call option should never be exercise early? 2.is it right that the American call option should never be exercise early if no divident paid? 3.is the binominal tree...
-
Define the relational model? What does the relational model consist of? What are the 4 relational models?Discuss
-
a) An AC mains line has frequency 50 Hz, and an amplitude of220V, to which a DC voltage of -20 volts is added, so that the voltage swings between -240 to +200 V. find: average value i) ii)...
-
Two charges are located on the x axis: q = +6.4C at x = +4.8 cm, and q2 = +6.4C at x = -4.8 cm. Two other charges are located on they axis: 93 = +2.7 C at y3 = +4.8 cm, and 94 = -5.8 C at y4 = +6.5...
-
You are doing a group assignment. Your teammate Sonia does not attend your first team meeting. What should you do? Email Sonia and say, "Hi Sonia, you missed the meeting. Don't let it happen again."...
-
Homework: Chapter 5 Homework Score: 0 of 10 pts P5-51A (similar to) 2 of 2 (1 complete) Save HW Score: 33.33%, 5 of 15 p Question Help Ruby Lips produces a lip balm used for cold-weather sports. The...
-
A researcher reports a significant two-way between-subjects ANOVA, F(3, 40) = 2.96. State the decision to retain or reject the null hypothesis for this test.
-
For each of the situations described below, select the type of analytics that would address the specific organizational need and justify your selection. a. A mid-sized bank would like to provide as...
-
Visit www.teradatauniversitynetwork.comand download the dimensional modeling tool located under the downloadable software section. Use this tool to draw your answers to Problems and Exercises 9-28,...
-
Say that you are interested in storing the numeric value 3,456,349.2334. What will be stored, with each of the following Oracle data types: a. NUMBER (ll) b. NUMBER (11,1) c. NUMBER (ll,-2) d. NUMBER...
-
Divide into groups of three or four students each. Each group should choose a company in the technology industry, such as Yahoo!, ebay, Apple, or Microsoft. Obtain the companys annual report or SEC...
-
Inventory Costing Methods} On June 1, Welding Products Company had a beginning inventory of 210 cases of welding rods that had been purchased for \(\$ 88\) per case. Welding Products purchased 1,150...
-
Effects of Inventory Costing Methods Borgia Enterprises has the following statement of earnings data available for 2018: Borgia uses a perpetual inventory accounting system and the weighted average...
Study smarter with the SolutionInn App