Declareandinitializethefollowingvariablesoftypedouble:grocery1,grocery2,grocery3,grocery4,grocery5nonGrocery1,nonGrocery2totalGrocery,totalNonGrocerytaxGrocery,taxNonGroc...
Declare and initialize the following variables of type double:
grocery1, grocery2, grocery3, grocery4, grocery5
nonGrocery1, nonGrocery2
totalGrocery, totalNonGrocery
taxGrocery, taxNonGrocery
totalCost, totalTax, grandTotal
Instantiate a Scanner object to read from the keyboard.
Use System.out.print to display the prompt "First grocery item: ".
Use the Scanner to read a double value from the user into grocery1.
Repeat for the second, third, fourth, and fifth grocery items, adjusting the prompts.
Use System.out.print to display the prompt "First non-grocery item: ".
Use the Scanner to read a double value from the user into nonGrocery1
Repeat for the second non-grocery item, adjusting the prompt.
Compute the total cost of the five grocery items (totalGrocery).
Compute the total cost of the two grocery items (totalNonGrocery).
展开