/** * CS149 - Introduction to Programming * Department of Computer Science * James Madison University * @version Fall 2018 */
See submission details below for all due dates and submission details. Note there are multiple submission parts.
This assignment should be completed individually to maximize learning. It is important that you adhere to the Course Policies, particularly the section on Programming Assignments. Also relevant is the JMU Honor Code.
Scanner
to read input of varying data types.print()
and println()
methods.You've just landed an exciting part-time job at a local bakery that is known throughout the Shenandoah Valley. Their breads and pastries are the best around, especially their unique cupcakes. Unfortunately, the owner has been filling out receipts for individual customers by hand since the shop opened in 1787. After working there for a few days, you mention that you're taking a programming course and might be able to help automate the process of writing receipts. The rest is history.
See the example input
and output
below for the general
idea. Create a new source file named Bakery.java
and
implement the entire program in the main
method. Provide
a meaningful Javadoc comment, including @author
and @version
tags. Write concise inline comments
(using //
) for each major section of the assignment
described below (e.g., gathering input, doing calculations, displaying
output). You should have these comments in place before writing any
code!
Your program will need to read and store a variety of information while displaying the prompts as shown in the following example:
Enter Customer's Personal Name: Jordan Enter Customer's Family Name: Lee Enter Product Code: cake22 Enter Product Quantity: 12 Enter Product Price: 0.99 Enter Discount Percent: 10
Specifically:
To get started, declare variables with meaningful names and types. Initialize
a Scanner
to handle the input, and use System.out.print
to display each prompt exactly as shown. There is no need to
handle invalid user input in this assignment.
Use the collected data to display a receipt that matches the following example exactly as shown. Insert a tab character (but no other spaces) between each column of the item table.
***** ***** \___/ BRENDON'S BAKERY \___/ Jordan Lee Date: 09/07/2018 Product Qty Price ------- --- ----- cake22 12 $0.99 Initial Cost: $11.879999999999999 Discount at 10.0%: $1.188 Tax at 5.3%: $0.566676 Final Cost: $11.258675999999998
Specifically:
Note that you may see strange results like 11.879999999999999 instead of 11.88. We will learn later in the semester how do deal with this problem. For now, you must simply print all values as-is. (Don't try to round, truncate, or format them to two decimal places.)
This assignment has three deadlines/parts that should be completed in order. By the first deadline you must complete a readiness quiz in Canvas, by the second deadline you must complete a textual algorithm quiz in Canvas, and by the third deadline you must submit your completed code through AutoLab.
Read this entire document and complete the quiz in Canvas. The grading for this quiz is all-or-nothing. You must answer all questions correctly by the deadline to get any credit. You will have as many attempts as you need, but if you do not answer all questions correctly by the deadline or you will receive no credit for this part.
After reading the specification and doing the quiz, you should complete the algorithm quiz in Canvas. Note that you only have one submission opportunity for this quiz so be careful taking it. NO LATE SUBMISSIONS WILL RECEIVE CREDIT FOR THIS PART!
Upload your
completed Bakery.java
file through AutoLab.
Bakery.java
. Before uploading your Bakery.java
file,
be sure to complete the following steps carefully:Your submission will be graded using the following criteria:
Requirement | Points |
---|---|
PART A: Readiness Quiz | 10 |
PART B: Algorithm | 10 |
PART C: Checkstyle | 10 |
PART C: Correctly scanned input | 20 |
PART C: Accurate calculations | 20 |
PART C: Correctly formatted output | 20 |
PART C: Instructor grading based on style and code quality | 10 |
Don't put off submission until the last possible minute! Any submission system may become bogged down when it receives a large number of submissions. You may have some unanticipated difficulties uploading your code. It is your responsibility to take these possibilities into account and submit early enough to ensure that the submission process is completed before the deadline.
Why did we
use the colors above (input/output)?
This assignment was originally developed by Chris Mayfield, edited by Nathan Sprague and repurposed by Dee Weikle.