Answered step by step
Verified Expert Solution
Question
1 Approved Answer
create grocery list: Store name: no leading or trailing whitespace; all characters should be upper case; the only String that may contain a space character
create grocery list:
- Store name: no leading or trailing whitespace; all characters should be upper case; the only String that may contain a space character (can be multiple words).
- All food and drink: no leading or trailing whitespace; all characters should be lower case.
Examples:
Store: the Farmer's Market amount1: 5 food1: Apples amount2: 12 food2: EggS amount3: 3 drink: milK weight1: 1.5 food3: CHEESE weight2: 3 food4: potatoes
The resulting:
Grocery List for *Name* I am going to THE FARMER'S MARKET to get: 5 apples 12 eggs 3 gallons of milk 1.5 pounds of cheese 3.0 pounds of potatoes
Note: there should always be 5 items in the grocery list, third is gallons, fouth and fifth are pounds
- Your main method should contain all input code (e.g., Scanner instance) and have 11 user prompts inputting values with nextInt(), nextDouble(), next(), and nextLine().
- All output code must be in the main method as well. The makeGroceryList method takes the arguments passed in and prepares the entire grocery list, using all the 11 parameters and returning one long String.
- You do not need to use the above grocery list. You can try out your own input values.
- Your grocery list must contain your name as you entered it in the file header comments. It should be a string literal and not passed in as a parameter. For example, at the start of your grocery list "Grocery List for *Name* ......"
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