Question: Trace the following program and write the output exactly it will appear on the screen if you run the program. (Show all of your

Trace the following program and write the output exactly it will appear

Trace the following program and write the output exactly it will appear on the screen if you run the program. (Show all of your work) public class Tracing_Practice { public static void main(String[] args) { //Products String fruits [] = {"Apple", "Orange", "Grapes", "Banana"}; // prices in dollars of products per pound double banana=0.98, grapes-3.25, apple-1.99, orange=2.29; // amount of products purchased by a customer in pounds double grapeLb-4.3, bananaLb-6.4, orange Lb-4.8, appleLb=6.2; //cost before tax double banaCost-banana*bananaLb; double grapeCost-grapes*grapeLb; double orangCost-orange*orangeLb; double appleCost-apple* appleLb; double [] costList = {appleCost, orangCost, grapeCost, banaCost}; double total-banaCost+grapeCost+appleCost+orangCost; double Tax total*0.13; Double payable= total+Tax; for(int list-fruits.length-1; list>-1; list--) { System.out.print(fruits [list]+"\t"+costList[list] +" "); }//end of for loop System.out.print("Total Before Tax:\t"+total+" "); System.out.print("Total Tax :\t"+Tax+" "); System.out.print("Total: \t\t"+ payable); }// end of main method //end of class

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!