Menu

Write Program Named Vegetablepricer Prompts User Vegetable Pricing Table Shown Program Di Q43883567

Write a program named”VegetablePricer” which prompts the user for a vegetable from thepricing table shown below. The program will then display the costper pound for that vegetable, again using the table provided.

  • Your program must use a switch statement to process the inputvalue and display the desired output.
    • Be sure to provide a defaultcase in your switch statement which handles unrecognizedinput.
  • Use named constants for all constant strings (e.g. prompts andvegetable names) and price values.
  • Provide an identification header block and descriptive commentsthroughout.
  • Use consistent indentation, whitespace for readability, andcamelHump format for multi-word variable names.
  • To read a String value from the keyboard, assuming a Scannervariable named input and String variable named s, use

s =input.nextLine();

  • When comparing two strings, you should either do acase-insensitive comparison or convert the strings to oneconsistent case. For instance, if my input variable for thisprogram is “String inVeg”, my switch statement to compare againstthe available choices looks like this:

switch(inVeg.toLowerCase()) {

   so I canconsistently compare against my all lower case vegetable namestring constants.

Vegetable PricingTable

VegetableName

VegetablePrice per Lb.

artichoke

$2.21

broccoli

$2.57

carrot

$0.74

okra

$3.21

tomato

$3.69

Expert Answer


Answer to Write a program named “VegetablePricer” which prompts the user for a vegetable from the pricing table shown below. The p…

OR