Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

INSTRUCTIONS 1 . 1 . Skills Demonstrated Concepts from Computer Science I: Variables, Naming Conventions, Documentation, Arithmetic Commands, Decision Structures, Loops, Formatting Numbers, Passing /

INSTRUCTIONS
1.1. Skills Demonstrated
Concepts from Computer Science I: Variables, Naming Conventions, Documentation, Arithmetic Commands, Decision Structures, Loops, Formatting Numbers, Passing/Returning data to/from a Method, Documentation Expectations for this course.
2. Instructions
Morning Brew Coffee Shop has a frequent buyer awards program for its customers based on the number of coffees they purchased each month. Points are awarded as follows:
o IIf a customer purchased 0 cups, they have earned 0.00 points.
o IIf a customer purchased 1 cup, they have earned 2.00 points.
o If a customer purchased 2 cups, they have earned 5.16 points.
o If a customer purchased 3 cups, they have earned 8.294 points.
o If a customer purchased 4 cups, they have earned 11.557 points.
o If a customer purchased 5 or more cups, they have earned 2.885 points for each cup purchased.The program is to do the math.
Write a program that:
2.
1. Utilizes a the Scanner Class and asks the user to enter the number of cups that they have purchased this month.
2. Using a separate PRIVATE method:
a. Validate the users input (a bad entry is the user entered a negative number)
b. If the value is a negative number, utilizing a loop, have the user re-enter their answer until correct
c. Return the valid entry
3. Utilizing nested if statements, the program will then display the number of cups purchased and the number of points awarded. Use the System.out.printf or String method to format the number of points to within 2 decimal places.
As comments, (or a seperate attachment): list the data you utilized to test your program and the result displayed. Be sure to test all options possible.
3. Grading Criteria
o Documentation Requirements
Include the 3 Opening Comments, method header comments, and program comments (1.5)
Your last name is contained in the demonstrating program name (0.5)
Follow the naming conventions for classes, variables, constants, and uses indentations and blank lines for readability ((0.5)
Test data and results are included as comments (0.5)
Coding Techniques not covered in class are documented (no negative points -0)
o Assignment Task Requirements
Utilizes nested if statements to determine points earned (2)
Calculates the correct total of points earned (2)
Utilizes a Scanner class for input/output to communicate with the User (2)
User inputs the required data (2)
Utilizes a private method and loop used to validate the users inputs. Utilizes a loop to offer the user additional chances to correct their input (2)
o Display Requirements - must compile to earn these points
Your program compiles and runs with no errors (3)
Instructions to the user are clear and understandable by someone not familiar with the assignment (0.5)
Data output is clearly labeled with spacing between labels and results (1)
Calculates and displays the correct points based on cups purchased (0.5)
The display for the number of points earned is formatted to 2 decimal positions (2)
o You must ATTACH the .java file before submitting the assignment.

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

T Sql Window Functions For Data Analysis And Beyond

Authors: Itzik Ben Gan

2nd Edition

0135861446, 978-0135861448

More Books

Students also viewed these Databases questions

Question

4. Describe the factors that influence self-disclosure

Answered: 1 week ago

Question

1. Explain key aspects of interpersonal relationships

Answered: 1 week ago