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)
Python def printlogo Prints the AM Coffee Shop logo in large letters logo printlogo def calculate... 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
-
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)...
-
Why would investors be attracted to bonds issued with warrants attached?
-
Graph the rational function. Include the graphs and equations of the asymptotes and dominant terms. y 1 2x + 4
-
Shiloh supplies equipment to the automotive and commercial vehicle markets and other industrial customers. It specializes in materials and designs that reduce vehicle weight and increase fuel...
-
The wheat harvesting season in the American Midwest is short, and most farmers deliver their truckloads of wheat to a giant central storage bin within a two-week span. Because of this, wheat-filled...
-
17-x, 2 for x 0 Let f(x) = Find each limit. 17+x, for x>0 (A) lim f(x) (B) lim f(x) x-0 (C) lim f(x) x-0 (D) f(0)
-
Crystal Corporation processes its journal vouchers using batch procedures similar to the process outlined in Figure in the text. To improve customer satisfaction, the sales system is going to be...
-
2. (2 points) Adele sells Dell keyboards for computers. She can sell 970 keyboards when the price is $53/key- board, and she can sell 870 keyboards when the price is $88/keyboard. Find the maximum...
-
(a) What is the Black-Scholes partial differential equation (PDE) for the price f(t, S) at time t of a European derivative security on a stock with price S,? What does each term in the equation mean?...
-
1. During the year, the taxpayer estimates an additional of P80,000 uncollectible accounts. From the estimated uncollectible accounts last period, P40,000 is ascertained to be a receivable from a...
-
A. The capital structure of MAID Company is as follows: Long-term debt Common stock, RM1 par RM 400 million RM 50 million Contributed capital in excess of par Retained earnings RM 250 million Total...
-
Accounting Rate of Return Vanderhoort Company invested $9,960,000 in a new product line. The life cycle of the product is projected to be seven years with the following net income stream: $360,000,...
-
The primary function of an actuary is to, a . negotiate reinsurance treaties. b . determine premium rates. c . adjust claims. d . invest insurance company assets
-
Consider vectors A = -51 + 2j and B = 6 5j. Now answer the following questions a. In which quadrant does vector A and B lie. What are the x and y coordinates of A and B? b. Show A+ B graphically and...
-
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...
-
______________ refers to the location, time, and occasion where communication occurs.
-
Identify the four steps of the KEYS process.
-
______________ is the general term for the discussion, determination, and deliberation processes that attempt to decide what is right or wrong, what others should or should not do, and what is...
Study smarter with the SolutionInn App