Answered step by step
Verified Expert Solution
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
Skills Demonstrated
Concepts from Computer Science I: Variables, Naming Conventions, Documentation, Arithmetic Commands, Decision Structures, Loops, Formatting Numbers, PassingReturning data tofrom a Method, Documentation Expectations for this course.
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 cups, they have earned points.
o IIf a customer purchased cup, they have earned points.
o If a customer purchased cups, they have earned points.
o If a customer purchased cups, they have earned points.
o If a customer purchased cups, they have earned points.
o If a customer purchased or more cups, they have earned points for each cup purchased.The program is to do the math.
Write a program that:
Utilizes a the Scanner Class and asks the user to enter the number of cups that they have purchased this month.
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 reenter their answer until correct
c Return the valid entry
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 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.
Grading Criteria
o Documentation Requirements
Include the Opening Comments, method header comments, and program comments
Your last name is contained in the demonstrating program name
Follow the naming conventions for classes, variables, constants, and uses indentations and blank lines for readability
Test data and results are included as comments
Coding Techniques not covered in class are documented no negative points
o Assignment Task Requirements
Utilizes nested if statements to determine points earned
Calculates the correct total of points earned
Utilizes a Scanner class for inputoutput to communicate with the User
User inputs the required data
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
o Display Requirements must compile to earn these points
Your program compiles and runs with no errors
Instructions to the user are clear and understandable by someone not familiar with the assignment
Data output is clearly labeled with spacing between labels and results
Calculates and displays the correct points based on cups purchased
The display for the number of points earned is formatted to decimal positions
o You must ATTACH the java file before submitting the assignment.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started